From dc35039af80fce6c33da9bfe474f9df44845859a Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 26 Feb 2025 09:41:03 +0100 Subject: [PATCH] chore: do not try to disconnect ws if not connected cf https://umap.sentry.io/issues/6331841272/ --- umap/sync/app.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/umap/sync/app.py b/umap/sync/app.py index 1d66b648..509aa130 100644 --- a/umap/sync/app.py +++ b/umap/sync/app.py @@ -112,11 +112,12 @@ class Peer: self.client = redis.from_url(settings.REDIS_URL) async def disconnect(self): - await self.client.hdel(self.room_key, self.peer_id) - for pubsub in self._subscriptions: - await pubsub.unsubscribe() - await pubsub.close() - await self.send_peers_list() + if self.is_authenticated: + await self.client.hdel(self.room_key, self.peer_id) + for pubsub in self._subscriptions: + await pubsub.unsubscribe() + await pubsub.close() + await self.send_peers_list() await self.client.aclose() async def send_peers_list(self):