Skip to content

Commit 03859f0

Browse files
authored
Merge branch 'master' into fix-automation-scenarion-maint-notification
2 parents e2f7367 + 028245c commit 03859f0

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

redis/asyncio/client.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,9 +1161,12 @@ async def get_message(
11611161
return await self.handle_message(response, ignore_subscribe_messages)
11621162
return None
11631163

1164-
def ping(self, message=None) -> Awaitable:
1164+
def ping(self, message=None) -> Awaitable[bool]:
11651165
"""
1166-
Ping the Redis server
1166+
Ping the Redis server to test connectivity.
1167+
1168+
Sends a PING command to the Redis server and returns True if the server
1169+
responds with "PONG".
11671170
"""
11681171
args = ["PING", message] if message is not None else ["PING"]
11691172
return self.execute_command(*args)

redis/client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,10 @@ def get_message(
11861186

11871187
def ping(self, message: Union[str, None] = None) -> bool:
11881188
"""
1189-
Ping the Redis server
1189+
Ping the Redis server to test connectivity.
1190+
1191+
Sends a PING command to the Redis server and returns True if the server
1192+
responds with "PONG".
11901193
"""
11911194
args = ["PING", message] if message is not None else ["PING"]
11921195
return self.execute_command(*args)

redis/commands/core.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,11 +1210,18 @@ def latency_reset(self, *events: str) -> ResponseT:
12101210
"""
12111211
return self.execute_command("LATENCY RESET", *events)
12121212

1213-
def ping(self, **kwargs) -> ResponseT:
1213+
def ping(self, **kwargs) -> Union[Awaitable[bool], bool]:
12141214
"""
1215-
Ping the Redis server
1215+
Ping the Redis server to test connectivity.
12161216
1217-
For more information, see https://redis.io/commands/ping
1217+
Sends a PING command to the Redis server and returns True if the server
1218+
responds with "PONG".
1219+
1220+
This command is useful for:
1221+
- Testing whether a connection is still alive
1222+
- Verifying the server's ability to serve data
1223+
1224+
For more information on the underlying ping command see https://redis.io/commands/ping
12181225
"""
12191226
return self.execute_command("PING", **kwargs)
12201227

0 commit comments

Comments
 (0)