Skip to content
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

Add default None for maxlen at xtrim command #2188

Merged
merged 3 commits into from
May 31, 2022
Merged
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
5 changes: 4 additions & 1 deletion redis/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3842,7 +3842,7 @@ def xrevrange(
def xtrim(
self,
name: KeyT,
maxlen: Union[int, None],
maxlen: Union[int, None] = None,
approximate: bool = True,
minid: Union[StreamIdT, None] = None,
limit: Union[int, None] = None,
Expand All @@ -3863,6 +3863,9 @@ def xtrim(
if maxlen is not None and minid is not None:
raise DataError("Only one of ``maxlen`` or ``minid`` " "may be specified")

if maxlen is None and minid is None:
raise DataError("One of ``maxlen`` or ``minid`` must be specified")

if maxlen is not None:
pieces.append(b"MAXLEN")
if minid is not None:
Expand Down