Commit 1487657
fix(client): XADD/XTRIM with LIMIT 0 must emit the argument (redis#3342)
`XADD ... TRIM.limit` and `XTRIM ... LIMIT` were guarded by a truthy check
(`if (options.TRIM.limit)` / `if (options?.LIMIT)`), so an explicit `0` was
silently dropped and the server fell back to its implicit default limit.
Per the Redis docs, `LIMIT 0` means unlimited trimming, whereas omitting
LIMIT caps eviction at `100 * stream-node-max-entries` (10000 by default),
so the two are observably different. Against Redis 8.8, trimming a
20000-entry stream with `MAXLEN ~ 1` evicts 10000 entries without LIMIT but
19900 with `LIMIT 0` — meaning a caller asking for unlimited trimming
currently gets the capped default instead.
Guard on `!== undefined` so `0` is forwarded, matching the recent XGROUP
ENTRIESREAD 0 fix (redis#3333). Adds a `LIMIT 0` argument test for both commands.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 264a7ab commit 1487657
4 files changed
Lines changed: 26 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
83 | 97 | | |
84 | 98 | | |
85 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
| 92 | + | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
0 commit comments