Skip to content

Commit 1000a2b

Browse files
authored
Add timeout parameter for SentinelManagedConnection (#2495)
1 parent f06f3db commit 1000a2b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
* Add `timeout=None` in `SentinelConnectionManager.read_response`
12
* Documentation fix: password protected socket connection (#2374)
23
* Allow `timeout=None` in `PubSub.get_message()` to wait forever
34
* add `nowait` flag to `asyncio.Connection.disconnect()`

redis/asyncio/sentinel.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import asyncio
22
import random
33
import weakref
4-
from typing import AsyncIterator, Iterable, Mapping, Sequence, Tuple, Type
4+
from typing import AsyncIterator, Iterable, Mapping, Optional, Sequence, Tuple, Type
55

66
from redis.asyncio.client import Redis
77
from redis.asyncio.connection import (
@@ -63,9 +63,16 @@ async def connect(self):
6363
lambda error: asyncio.sleep(0),
6464
)
6565

66-
async def read_response(self, disable_decoding: bool = False):
66+
async def read_response(
67+
self,
68+
disable_decoding: bool = False,
69+
timeout: Optional[float] = None,
70+
):
6771
try:
68-
return await super().read_response(disable_decoding=disable_decoding)
72+
return await super().read_response(
73+
disable_decoding=disable_decoding,
74+
timeout=timeout,
75+
)
6976
except ReadOnlyError:
7077
if self.connection_pool.is_master:
7178
# When talking to a master, a ReadOnlyError when likely

0 commit comments

Comments
 (0)