Skip to content

Commit 477b9f9

Browse files
committed
optimization changes
1 parent db57f93 commit 477b9f9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

redis/commands/core.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,7 +3499,7 @@ def xackdel(
34993499
if not ids:
35003500
raise DataError("XACKDEL requires at least one message ID")
35013501

3502-
if ref_policy not in ("KEEPREF", "DELREF", "ACKED"):
3502+
if ref_policy not in {"KEEPREF", "DELREF", "ACKED"}:
35033503
raise DataError("XACKDEL ref_policy must be one of: KEEPREF, DELREF, ACKED")
35043504

35053505
pieces = [name, groupname, ref_policy, "IDS", len(ids)]
@@ -3541,11 +3541,9 @@ def xadd(
35413541
if maxlen is not None and minid is not None:
35423542
raise DataError("Only one of ```maxlen``` or ```minid``` may be specified")
35433543

3544-
if ref_policy is not None and ref_policy not in ("KEEPREF", "DELREF", "ACKED"):
3544+
if ref_policy is not None and ref_policy not in {"KEEPREF", "DELREF", "ACKED"}:
35453545
raise DataError("XADD ref_policy must be one of: KEEPREF, DELREF, ACKED")
35463546

3547-
if nomkstream:
3548-
pieces.append(b"NOMKSTREAM")
35493547
if maxlen is not None:
35503548
if not isinstance(maxlen, int) or maxlen < 0:
35513549
raise DataError("XADD maxlen must be non-negative integer")
@@ -3560,6 +3558,8 @@ def xadd(
35603558
pieces.append(minid)
35613559
if limit is not None:
35623560
pieces.extend([b"LIMIT", limit])
3561+
if nomkstream:
3562+
pieces.append(b"NOMKSTREAM")
35633563
if ref_policy is not None:
35643564
pieces.append(ref_policy)
35653565
pieces.append(id)
@@ -3728,7 +3728,7 @@ def xdelex(
37283728
if not ids:
37293729
raise DataError("XDELEX requires at least one message ID")
37303730

3731-
if ref_policy not in ("KEEPREF", "DELREF", "ACKED"):
3731+
if ref_policy not in {"KEEPREF", "DELREF", "ACKED"}:
37323732
raise DataError("XDELEX ref_policy must be one of: KEEPREF, DELREF, ACKED")
37333733

37343734
pieces = [name, ref_policy, "IDS", len(ids)]
@@ -4111,7 +4111,7 @@ def xtrim(
41114111
if maxlen is None and minid is None:
41124112
raise DataError("One of ``maxlen`` or ``minid`` must be specified")
41134113

4114-
if ref_policy is not None and ref_policy not in ("KEEPREF", "DELREF", "ACKED"):
4114+
if ref_policy is not None and ref_policy not in {"KEEPREF", "DELREF", "ACKED"}:
41154115
raise DataError("XTRIM ref_policy must be one of: KEEPREF, DELREF, ACKED")
41164116

41174117
if maxlen is not None:

0 commit comments

Comments
 (0)