Skip to content

Commit 05f9634

Browse files
fix test with redis@5
1 parent 8a3d87d commit 05f9634

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

lib/util.ts

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ function mapResult(result) {
5757
};
5858
}
5959

60+
// https://redis.io/docs/latest/commands/xread/#blocking-for-data
6061
const BLOCK_DURATION_IN_MS = 200;
6162

6263
/**
@@ -69,23 +70,18 @@ export function XREAD(
6970
readCount: number
7071
) {
7172
if (isNodeRedisClient(redisClient)) {
72-
return import("redis").then((redisPackage) => {
73-
return redisClient.xRead(
74-
redisPackage.commandOptions({
75-
isolated: true,
76-
}),
77-
[
78-
{
79-
key: streamName,
80-
id: offset,
81-
},
82-
],
73+
return redisClient.xRead(
74+
[
8375
{
84-
COUNT: readCount,
85-
BLOCK: BLOCK_DURATION_IN_MS,
86-
}
87-
);
88-
});
76+
key: streamName,
77+
id: offset,
78+
},
79+
],
80+
{
81+
COUNT: readCount,
82+
BLOCK: BLOCK_DURATION_IN_MS,
83+
}
84+
);
8985
} else {
9086
return redisClient
9187
.xread(

0 commit comments

Comments
 (0)