diff --git a/CHANGES b/CHANGES index ea171f6bb5..4917980126 100644 --- a/CHANGES +++ b/CHANGES @@ -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 d67291b314..6d0d41ea32 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -3485,8 +3485,8 @@ def xadd( 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"~")