Skip to content

Commit 623b56b

Browse files
authored
fix cluster.sUnsubscribe - make listener optional
1 parent e91509a commit 623b56b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

packages/client/lib/cluster/index.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ export interface RedisClusterOptions<
2020
S extends RedisScripts = Record<string, never>
2121
> extends RedisExtensions<M, F, S> {
2222
/**
23-
* Should contain details for some of the cluster nodes that the client will use to discover
23+
* Should contain details for some of the cluster nodes that the client will use to discover
2424
* the "cluster topology". We recommend including details for at least 3 nodes here.
2525
*/
2626
rootNodes: Array<RedisClusterClientOptions>;
2727
/**
28-
* Default values used for every client in the cluster. Use this to specify global values,
28+
* Default values used for every client in the cluster. Use this to specify global values,
2929
* for example: ACL credentials, timeouts, TLS configuration etc.
3030
*/
3131
defaults?: Partial<RedisClusterClientOptions>;
@@ -45,7 +45,7 @@ export interface RedisClusterOptions<
4545
/**
4646
* Mapping between the addresses in the cluster (see `CLUSTER SHARDS`) and the addresses the client should connect to
4747
* Useful when the cluster is running on another network
48-
*
48+
*
4949
*/
5050
nodeAddressMap?: NodeAddressMap;
5151
}
@@ -98,7 +98,7 @@ export default class RedisCluster<
9898
readonly #options: RedisClusterOptions<M, F, S>;
9999

100100
readonly #slots: RedisClusterSlots<M, F, S>;
101-
101+
102102
get slots() {
103103
return this.#slots.slots;
104104
}
@@ -310,7 +310,7 @@ export default class RedisCluster<
310310
listener?: PubSubListener<boolean>,
311311
bufferMode?: T
312312
) {
313-
return this.#slots.executeUnsubscribeCommand(client =>
313+
return this.#slots.executeUnsubscribeCommand(client =>
314314
client.UNSUBSCRIBE(channels, listener, bufferMode)
315315
);
316316
}
@@ -333,7 +333,7 @@ export default class RedisCluster<
333333
listener?: PubSubListener<T>,
334334
bufferMode?: T
335335
) {
336-
return this.#slots.executeUnsubscribeCommand(client =>
336+
return this.#slots.executeUnsubscribeCommand(client =>
337337
client.PUNSUBSCRIBE(patterns, listener, bufferMode)
338338
);
339339
}
@@ -344,7 +344,7 @@ export default class RedisCluster<
344344
channels: string | Array<string>,
345345
listener: PubSubListener<T>,
346346
bufferMode?: T
347-
) {
347+
) {
348348
const maxCommandRedirections = this.#options.maxCommandRedirections ?? 16,
349349
firstChannel = Array.isArray(channels) ? channels[0] : channels;
350350
let client = await this.#slots.getShardedPubSubClient(firstChannel);
@@ -371,7 +371,7 @@ export default class RedisCluster<
371371

372372
SUNSUBSCRIBE<T extends boolean = false>(
373373
channels: string | Array<string>,
374-
listener: PubSubListener<T>,
374+
listener?: PubSubListener<T>,
375375
bufferMode?: T
376376
) {
377377
return this.#slots.executeShardedUnsubscribeCommand(
@@ -391,7 +391,7 @@ export default class RedisCluster<
391391
}
392392

393393
nodeClient(node: ShardNode<M, F, S>) {
394-
return this.#slots.nodeClient(node);
394+
return this.#slots.nodeClient(node);
395395
}
396396

397397
getRandomNode() {

0 commit comments

Comments
 (0)