Skip to content

Commit adebbc8

Browse files
endothermicdevcdecker
authored andcommitted
historian: don't crash on rabbitmq stream loss
1 parent deafb81 commit adebbc8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

archived/historian/historian.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,11 +297,16 @@ def publish(self, raw: bytes) -> None:
297297
gossipd.ChannelAnnouncement,
298298
gossipd.NodeAnnouncement]:
299299
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()
305310
return
306311

307312

0 commit comments

Comments
 (0)