diff --git a/lib/DataHandler.ts b/lib/DataHandler.ts index 717de6d..2392159 100644 --- a/lib/DataHandler.ts +++ b/lib/DataHandler.ts @@ -56,9 +56,13 @@ export default class DataHandler { }, }); - redis.stream.on("data", (data) => { + redis.stream.prependListener("data", (data) => { parser.execute(data); }); + + // `prependListener` not switching a stream to flowing mode as `on` does, + // so we need to do it manually in case if our listener is the first one + redis.stream.resume(); } private returnFatalError(err: Error) {