Skip to content

Commit

Permalink
Fix xadd allow non negative maxlen (#2739)
Browse files Browse the repository at this point in the history
* Fix xadd allow non negative maxlen

* Update change log

---------

Co-authored-by: dvora-h <67596500+dvora-h@users.noreply.github.com>
  • Loading branch information
aciddust and dvora-h committed May 8, 2023
1 parent 984b733 commit 4a4566b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3496,8 +3496,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"~")
Expand Down

0 comments on commit 4a4566b

Please sign in to comment.