1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-10 18:40:53 +00:00

Improved rabbitmq connection lost recovery

This commit is contained in:
Tuna Celik 2020-08-18 11:26:25 +02:00
parent 95eb44a87f
commit 46d1a31441

View file

@ -1,5 +1,5 @@
import pika import pika
from pika.exceptions import ChannelWrongStateError from pika.exceptions import ChannelWrongStateError, StreamLostError
from radicale import hook from radicale import hook
from radicale.hook import HookNotificationItem from radicale.hook import HookNotificationItem
@ -39,7 +39,8 @@ class Hook(hook.BaseHook):
) )
) )
except Exception as e: except Exception as e:
if isinstance(e, ChannelWrongStateError) and recall: if (isinstance(e, ChannelWrongStateError) or
isinstance(e, StreamLostError)) and recall:
self._make_connection_synced() self._make_connection_synced()
self._notify(notification_item, False) self._notify(notification_item, False)
return return