You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
Fix: XAUTOCLAIM after a TRIM with pending messages returns nil (#2565)
* fix(client): XCLAIM & XAUTOCLAIM after a TRIM might return nils * fix(client): Fix race condition in specs * revert test utils changes * make tests faster --------- Co-authored-by: Leibale Eidelman <me@leibale.com>
This commit is contained in:
@@ -83,8 +83,38 @@ describe('XCLAIM', () => {
|
||||
});
|
||||
|
||||
assert.deepEqual(
|
||||
await client.xClaim('key', 'group', 'consumer', 1, '0-0'),
|
||||
await client.xClaim('key', 'group', 'consumer', 0, '0-0'),
|
||||
[]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
testUtils.testWithClient('client.xClaim with a message', async client => {
|
||||
await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true });
|
||||
const id = await client.xAdd('key', '*', { foo: 'bar' });
|
||||
await client.xReadGroup('group', 'consumer', { key: 'key', id: '>' });
|
||||
|
||||
assert.deepEqual(
|
||||
await client.xClaim('key', 'group', 'consumer', 0, id),
|
||||
[{
|
||||
id,
|
||||
message: Object.create(null, { 'foo': {
|
||||
value: 'bar',
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
} })
|
||||
}]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
|
||||
testUtils.testWithClient('client.xClaim with a trimmed message', async client => {
|
||||
await client.xGroupCreate('key', 'group', '$', { MKSTREAM: true });
|
||||
const id = await client.xAdd('key', '*', { foo: 'bar' });
|
||||
await client.xReadGroup('group', 'consumer', { key: 'key', id: '>' });
|
||||
await client.xTrim('key', 'MAXLEN', 0);
|
||||
|
||||
assert.deepEqual(
|
||||
await client.xClaim('key', 'group', 'consumer', 0, id),
|
||||
testUtils.isVersionGreaterThan([7, 0]) ? []: [null]
|
||||
);
|
||||
}, GLOBAL.SERVERS.OPEN);
|
||||
});
|
||||
|
Reference in New Issue
Block a user