summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlaixintao <laixintaoo@gmail.com>2022-06-22 23:50:23 +0800
committerlaixintao <laixintaoo@gmail.com>2022-06-22 23:50:36 +0800
commit2bd0e8b170cff8c66f91e51d0e6c88438f7ef5c9 (patch)
tree8f3e6987059fd64397fe0496f7f91fe6afea5b7c
parent85862ff0a5644c14b8edd3e44ca48966b410acca (diff)
client kill laddr
-rw-r--r--CHANGELOG.md4
-rw-r--r--iredis/redis_grammar.py3
-rw-r--r--tests/unittests/command_parse/test_server.py12
3 files changed, 19 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 388edbf..7003f65 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## UPCOMING
+
+- Feature: `CLIENT KILL` now support `LADDR` argument.
+-
## 1.11.1
- Bugfix: Switch `distutils.version` to `packaging.version` to fix the version parse
diff --git a/iredis/redis_grammar.py b/iredis/redis_grammar.py
index c06d8d3..e0bbc92 100644
--- a/iredis/redis_grammar.py
+++ b/iredis/redis_grammar.py
@@ -45,6 +45,7 @@ CONST = {
"on_off": "ON OFF",
"const_id": "ID",
"addr": "ADDR",
+ "laddr": "LADDR",
"skipme": "SKIPME",
"yes": "YES NO",
"migratechoice": "COPY REPLACE",
@@ -279,6 +280,7 @@ ON_OFF = rf"(?P<on_off>{c('on_off')})"
CONST_ID = rf"(?P<const_id>{c('const_id')})"
CONST_USER = rf"(?P<const_user>{c('const_user')})"
ADDR = rf"(?P<addr>{c('addr')})"
+LADDR = rf"(?P<laddr>{c('laddr')})"
SKIPME = rf"(?P<skipme>{c('skipme')})"
YES = rf"(?P<yes>{c('yes')})"
MIGRATECHOICE = rf"(?P<migratechoice>{c('migratechoice')})"
@@ -473,6 +475,7 @@ GRAMMAR = {
(
(\s+ {IP_PORT})|
(\s+ {ADDR} \s+ {IP_PORT})|
+ (\s+ {LADDR} \s+ {IP_PORT})|
(\s+ {CONST_ID} \s+ {CLIENTID})|
(\s+ {TYPE_CONST} \s+ {CONNTYPE})|
(\s+ {CONST_USER} \s+ {USERNAME})|
diff --git a/tests/unittests/command_parse/test_server.py b/tests/unittests/command_parse/test_server.py
index 5129e5f..fff7e46 100644
--- a/tests/unittests/command_parse/test_server.py
+++ b/tests/unittests/command_parse/test_server.py
@@ -72,6 +72,18 @@ def test_client_kill(judge_command):
{"command": "CLIENT KILL", "ip_port": "127.0.0.1:12345"},
)
judge_command(
+ "CLIENT KILL ADDR 127.0.0.1:12345 ",
+ {"command": "CLIENT KILL", "ip_port": "127.0.0.1:12345", "addr": "ADDR"},
+ )
+ judge_command(
+ "CLIENT KILL LADDR 127.0.0.1:12345 ",
+ {"command": "CLIENT KILL", "ip_port": "127.0.0.1:12345", "laddr": "LADDR"},
+ )
+ judge_command(
+ "CLIENT KILL USER myuser",
+ {"command": "CLIENT KILL", "const_user": "USER", "username": "myuser"},
+ )
+ judge_command(
"CLIENT KILL id 123455 type pubsub skipme no",
{
"command": "CLIENT KILL",