Skip to content

Commit 9fae44c

Browse files
committed
fix: revert "feat: update ioredis to 5x"
This reverts commit 3aa2b40.
1 parent f20225d commit 9fae44c

File tree

3 files changed

+56
-59
lines changed

3 files changed

+56
-59
lines changed

package-lock.json

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,15 @@
3737
},
3838
"dependencies": {
3939
"debug": "^4.3.4",
40-
"ioredis": "^5.2.3"
40+
"ioredis": "^4.27.2"
41+
},
42+
"peerDependencies": {
43+
"@types/ioredis": "^4"
44+
},
45+
"peerDependenciesMeta": {
46+
"@types/ioredis": {
47+
"optional": true
48+
}
4149
},
4250
"devDependencies": {
4351
"@calebboyd/semantic-release-config": "^1.0.1",

src/redis.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ChainableCommander } from 'ioredis'
1+
import { Pipeline } from 'ioredis'
22
import { RedisStream } from './stream.js'
33
import mkDebug from 'debug'
44
import { XBatchResult, XStreamResult } from './types.js'
@@ -21,11 +21,6 @@ export async function readAckDelete(
2121
ack(pipeline, stream)
2222
read(pipeline, stream)
2323
const responses = await pipeline.exec()
24-
25-
if (!responses) {
26-
return
27-
}
28-
2924
//TODO NOGROUP the consumer group this client was blocked on no longer exists
3025
for (const result of responses) {
3126
if (result[0] && !result[0]?.message.startsWith('BUSYGROUP')) {
@@ -47,10 +42,7 @@ export async function readAckDelete(
4742
}
4843
}
4944

50-
function ack(
51-
client: ChainableCommander,
52-
{ deleteOnAck, pendingAcks, group }: RedisStream<KindaAny>
53-
): void {
45+
function ack(client: Pipeline, { deleteOnAck, pendingAcks, group }: RedisStream<KindaAny>): void {
5446
if (!group || !pendingAcks.size) return
5547
for (const [stream, ids] of pendingAcks) {
5648
client.xack(stream, group, ...ids)
@@ -59,14 +51,11 @@ function ack(
5951
pendingAcks.clear()
6052
}
6153

62-
function xgroup(
63-
client: ChainableCommander,
64-
{ group, streams, first }: RedisStream<KindaAny>
65-
): void {
54+
function xgroup(client: Pipeline, { group, streams, first }: RedisStream<KindaAny>): void {
6655
if (!first || !group) return
6756
for (const [key, start] of streams) {
6857
debug(`xgroup create ${key} ${group} ${start} mkstream`)
69-
client.xgroup('CREATE', key, group, start, 'MKSTREAM')
58+
client.xgroup('create', key, group, start, 'mkstream')
7059
}
7160
}
7261

0 commit comments

Comments
 (0)