Skip to content

Commit

Permalink
Fix: Process multiple received streams concurrently. (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamimaj authored Feb 29, 2024
1 parent c53b6b8 commit ce2f7b9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions lib/redis.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,10 @@ export class RedisStreamClient extends ClientProxy {
// if BLOCK time ended, and results are null, listen again.
if (!results) return this.listenOnStreams();

const [key, messages] = results[0];

await this.notifyHandlers(key, messages);
for (let result of results) {
let [stream, messages] = result;
await this.notifyHandlers(stream, messages);
}

return this.listenOnStreams();
} catch (error) {
Expand Down
7 changes: 4 additions & 3 deletions lib/redis.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,10 @@ export class RedisStreamStrategy
// if BLOCK time ended, and results are null, listen again.
if (!results) return this.listenOnStreams();

const [key, messages] = results[0];

await this.notifyHandlers(key, messages);
for (let result of results) {
let [stream, messages] = result;
await this.notifyHandlers(stream, messages);
}

return this.listenOnStreams();
} catch (error) {
Expand Down

0 comments on commit ce2f7b9

Please sign in to comment.