-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
The issue refers to: https://redis.readthedocs.io/en/stable/commands.html#redis.commands.core.CoreCommands.ping
The documentation of the ping() method is unclear or confusing. According to the documentation, the return value is:
Union[Awaitable, Any]
In practice, however, the callback logic always returns a bool by default. See:
redis-py/redis/_parsers/helpers.py
Line 734 in 64f291f
"PING": lambda r: str_if_bytes(r) == "PONG",
I suggest changing the return-type in the documentation to:
Union[Awaitable, bool]
It would also be helpful if the mode of operation were also mentioned in the description. Because the current text only refers to the redis.io PING documentation, which says that the return value is a string with the value “PONG”:
Ping the Redis server
For more information see https://redis.io/commands/ping
I would suggest something like:
Ping the Redis server
Send
PING
1 command to server and returns booleanTrue
if the server's response equals "PONG"2.1For more information on the underlying ping command see https://redis.io/commands/ping
2This default behaviour can be overwritten by setting a custom callback.
Note: This is a follow-up of redis/redis-doc#2717 which wasn't resolved yet, but may not be handled any more as the repository is marked as obsolete.