File tree 1 file changed +14
-6
lines changed 1 file changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -297,22 +297,30 @@ def publish(self, raw: bytes) -> None:
297
297
gossipd .ChannelAnnouncement ,
298
298
gossipd .NodeAnnouncement ]:
299
299
if isinstance (msg , msg_type ):
300
- self .channel .basic_publish (exchange = 'router.gossip' ,
301
- # unused by fanout exchange
302
- routing_key = '' ,
303
- body = serialize (raw , self .node_id ,
304
- self .network ))
300
+ try :
301
+ self .channel .basic_publish (exchange = 'router.gossip' ,
302
+ # unused by fanout exchange
303
+ routing_key = '' ,
304
+ body = serialize (raw , self .node_id ,
305
+ self .network ))
306
+
307
+ except pika .exceptions .StreamLostError :
308
+ plugin .log ("lost connection to rabbitmq, reconnecting" )
309
+ self .rabbitmq_connect ()
305
310
return
306
311
307
312
308
313
309
314
@plugin .init ()
310
315
def init (plugin , configuration , options ):
311
316
print (options )
312
- with create_engine (options ['historian-dsn' ], echo = False ) as engine :
317
+ try :
318
+ engine = create_engine (options ['historian-dsn' ], echo = False )
313
319
Base .metadata .create_all (engine )
314
320
plugin .engine = engine
315
321
Flusher (engine ).start ()
322
+ finally :
323
+ engine .dispose ()
316
324
317
325
318
326
@plugin .method ('historian-stats' )
You can’t perform that action at this time.
0 commit comments