File tree Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Expand file tree Collapse file tree 1 file changed +8
-14
lines changed Original file line number Diff line number Diff line change @@ -427,26 +427,20 @@ def _notify_consumers(self, mtype):
427427 async def _ensure_redis (self ):
428428 if self ._redis is None :
429429 if self .master_name is None :
430- self ._redis = aioredis .Redis (
431- connection_pool = aioredis .ConnectionPool .from_url (
432- self .host ["address" ]
433- )
434- )
430+ pool = aioredis .ConnectionPool .from_url (self .host ["address" ])
435431 else :
436432 # aioredis default timeout is way too low
437- self ._redis = aioredis .sentinel .Sentinel (
438- self .host ["sentinels" ], socket_timeout = 2
433+ pool = aioredis .sentinel .SentinelConnectionPool (
434+ self .master_name ,
435+ aioredis .sentinel .Sentinel (
436+ self .host ["sentinels" ], socket_timeout = 2
437+ ),
439438 )
440-
441- def _get_aioredis_pool (self ):
442- if self .master_name is None :
443- return self ._redis .connection_pool
444- else :
445- return self ._redis .master_for (self .master_name ).connection_pool
439+ self ._redis = aioredis .Redis (connection_pool = pool )
446440
447441 async def _get_redis_conn (self ):
448442 await self ._ensure_redis ()
449- return aioredis . Redis ( connection_pool = self ._get_aioredis_pool ())
443+ return self ._redis
450444
451445 async def _put_redis_conn (self , conn ):
452446 if conn :
You can’t perform that action at this time.
0 commit comments