Skip to content

Support for QUIT #1557

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ class Redis(Commands, object):
'MODULE LIST': lambda r: [pairs_to_dict(m) for m in r],
'OBJECT': parse_object,
'PING': lambda r: str_if_bytes(r) == 'PONG',
'QUIT': bool_ok,
'STRALGO': parse_stralgo,
'PUBSUB NUMSUB': parse_pubsub_numsub,
'RANDOMKEY': lambda r: r and r or None,
Expand Down
6 changes: 6 additions & 0 deletions redis/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,12 @@ def ping(self):
"Ping the Redis server"
return self.execute_command('PING')

def quit(self):
"""Ask the server to close the connection.
https://redis.io/commands/quit
"""
return self.execute_command('QUIT')

def save(self):
"""
Tell the Redis server to save its data to disk,
Expand Down
3 changes: 3 additions & 0 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,9 @@ def test_object(self, r):
def test_ping(self, r):
assert r.ping()

def test_quit(self, r):
assert r.quit()

def test_slowlog_get(self, r, slowlog):
assert r.slowlog_reset()
unicode_string = chr(3456) + 'abcd' + chr(3421)
Expand Down