Skip to content

Commit

Permalink
fix(sharded): properly unsubscribe when closing
Browse files Browse the repository at this point in the history
Providing an array of channels to the SUNSUBSCRIBE command assumes all
the channels are allocated to the same slot, which is not always the
case, so we need to issue one command per channel.

Related: #500
  • Loading branch information
darrachequesne committed May 14, 2023
1 parent 42c8ab6 commit 2da8d9e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/sharded-adapter.ts
Expand Up @@ -108,7 +108,9 @@ class ShardedRedisAdapter extends ClusterAdapter {
});
}

return SUNSUBSCRIBE(this.subClient, channels);
return Promise.all(
channels.map((channel) => SUNSUBSCRIBE(this.subClient, channel))
).then();
}

override publishMessage(message) {
Expand Down

0 comments on commit 2da8d9e

Please sign in to comment.