diff options
Diffstat (limited to 'src/apscheduler/eventbrokers/async_redis.py')
-rw-r--r-- | src/apscheduler/eventbrokers/async_redis.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/apscheduler/eventbrokers/async_redis.py b/src/apscheduler/eventbrokers/async_redis.py index faa5438..00d526f 100644 --- a/src/apscheduler/eventbrokers/async_redis.py +++ b/src/apscheduler/eventbrokers/async_redis.py @@ -1,5 +1,7 @@ from __future__ import annotations +from asyncio import CancelledError + import anyio import attrs import tenacity @@ -105,8 +107,13 @@ class AsyncRedisEventBroker(LocalAsyncEventBroker, DistributedEventBrokerMixin): event = self.reconstitute_event(msg["data"]) if event is not None: await self.publish_local(event) - except Exception: - self._logger.exception(f"{self.__class__.__name__} listener crashed") + except Exception as exc: + # CancelledError is a subclass of Exception in Python 3.7 + if not isinstance(exc, CancelledError): + self._logger.exception( + f"{self.__class__.__name__} listener crashed" + ) + await pubsub.close() raise |