File tree 1 file changed +8
-14
lines changed
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):
427
427
async def _ensure_redis (self ):
428
428
if self ._redis is None :
429
429
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" ])
435
431
else :
436
432
# 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
+ ),
439
438
)
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 )
446
440
447
441
async def _get_redis_conn (self ):
448
442
await self ._ensure_redis ()
449
- return aioredis . Redis ( connection_pool = self ._get_aioredis_pool ())
443
+ return self ._redis
450
444
451
445
async def _put_redis_conn (self , conn ):
452
446
if conn :
You can’t perform that action at this time.
0 commit comments