diff options
author | Seongchuel Ahn <aciddust20@gmail.com> | 2023-05-08 20:16:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-08 14:16:26 +0300 |
commit | 4a4566b59a07289ebe6e18bf351ad666fa419a00 (patch) | |
tree | 6ff94e8f9d6b89af27a9897a7fb9f51bd324f5c0 | |
parent | 984b733d52b44ec75e2c9ff53689a7b6fa86d719 (diff) | |
download | redis-py-4a4566b59a07289ebe6e18bf351ad666fa419a00.tar.gz |
Fix `xadd` allow non negative maxlen (#2739)
* Fix xadd allow non negative maxlen
* Update change log
---------
Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | redis/commands/core.py | 4 |
2 files changed, 3 insertions, 2 deletions
@@ -1,3 +1,4 @@ + * Fix `xadd` command to accept non-negative `maxlen` including 0 * Revert #2104, #2673, add `disconnect_on_error` option to `read_response()` (issues #2506, #2624) * Add `address_remap` parameter to `RedisCluster` * Fix incorrect usage of once flag in async Sentinel diff --git a/redis/commands/core.py b/redis/commands/core.py index 1a4acb2..f2d7bf2 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -3496,8 +3496,8 @@ class StreamCommands(CommandsProtocol): raise DataError("Only one of ```maxlen``` or ```minid``` may be specified") if maxlen is not None: - if not isinstance(maxlen, int) or maxlen < 1: - raise DataError("XADD maxlen must be a positive integer") + if not isinstance(maxlen, int) or maxlen < 0: + raise DataError("XADD maxlen must be non-negative integer") pieces.append(b"MAXLEN") if approximate: pieces.append(b"~") |