From e8fff07b367929794e5e30cecbf252b72d307c16 Mon Sep 17 00:00:00 2001 From: Miguel Grinberg Date: Sun, 14 Nov 2021 13:08:05 +0000 Subject: [PATCH] Configure Redis pubsub to skip subscription messages --- src/socketio/asyncio_redis_manager.py | 2 +- src/socketio/redis_manager.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/socketio/asyncio_redis_manager.py b/src/socketio/asyncio_redis_manager.py index 41a62c6..d9da5f9 100644 --- a/src/socketio/asyncio_redis_manager.py +++ b/src/socketio/asyncio_redis_manager.py @@ -51,7 +51,7 @@ class AsyncRedisManager(AsyncPubSubManager): # pragma: no cover def _redis_connect(self): self.redis = aioredis.Redis.from_url(self.redis_url, **self.redis_options) - self.pubsub = self.redis.pubsub() + self.pubsub = self.redis.pubsub(ignore_subscribe_messages=True) async def _publish(self, data): retry = True diff --git a/src/socketio/redis_manager.py b/src/socketio/redis_manager.py index 6ac0601..ab40739 100644 --- a/src/socketio/redis_manager.py +++ b/src/socketio/redis_manager.py @@ -70,7 +70,7 @@ class RedisManager(PubSubManager): # pragma: no cover def _redis_connect(self): self.redis = redis.Redis.from_url(self.redis_url, **self.redis_options) - self.pubsub = self.redis.pubsub() + self.pubsub = self.redis.pubsub(ignore_subscribe_messages=True) def _publish(self, data): retry = True