File tree Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Expand file tree Collapse file tree 1 file changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,7 @@ function mapResult(result) {
5757 } ;
5858}
5959
60+ // https://redis.io/docs/latest/commands/xread/#blocking-for-data
6061const 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 (
You can’t perform that action at this time.
0 commit comments