Skip to content

Commit 2da8d9e

Browse files
fix(sharded): properly unsubscribe when closing
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
1 parent 42c8ab6 commit 2da8d9e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/sharded-adapter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,9 @@ class ShardedRedisAdapter extends ClusterAdapter {
108108
});
109109
}
110110

111-
return SUNSUBSCRIBE(this.subClient, channels);
111+
return Promise.all(
112+
channels.map((channel) => SUNSUBSCRIBE(this.subClient, channel))
113+
).then();
112114
}
113115

114116
override publishMessage(message) {

0 commit comments

Comments
 (0)