From ccc7ba07ce9482331fe80a5f8ce3be1f3fbe2685 Mon Sep 17 00:00:00 2001 From: Pat Buxton Date: Tue, 31 Oct 2023 15:16:05 +0000 Subject: [PATCH] Close on disconnect --- redis_stomp/pubsub/topic.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/redis_stomp/pubsub/topic.py b/redis_stomp/pubsub/topic.py index d6c3a6a..367e1a4 100644 --- a/redis_stomp/pubsub/topic.py +++ b/redis_stomp/pubsub/topic.py @@ -34,6 +34,10 @@ def __init__(self, connection: StompConnection, redis_url: str): self._closed = False self._redis = connect(redis_url, decode_responses=True).pubsub(ignore_subscribe_messages=True) + async def disconnect(self, connection: StompConnection): + await super().disconnect(connection) + await self.close() + async def close(self): self._closing = True while not self._closed: