Correct cluster options type to match what's actually happening within ioredis. Non-Numbers can be returned to end the retry loop

This commit is contained in:
Alex Petty
2019-01-10 14:51:47 -06:00
parent 70fe269343
commit 8bd80cab81
4 changed files with 22 additions and 2 deletions
+2 -1
View File
@@ -10,6 +10,7 @@
// Dmitry Motovilov <https://github.com/funthing>
// Oleg Repin <https://github.com/iamolegga>
// Ting-Wai To <https://github.com/tingwai-to>
// Alex Petty <https://github.com/pettyalex>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -972,7 +973,7 @@ declare namespace IORedis {
}
interface ClusterOptions {
clusterRetryStrategy?(times: number): number;
clusterRetryStrategy?(times: number): number | null;
enableOfflineQueue?: boolean;
enableReadyCheck?: boolean;
scaleReads?: string;
+9
View File
@@ -192,3 +192,12 @@ redis.xread('STREAMS', 'streamName', '0-0');
redis.xreadgroup('GROUP', 'groupName', 'consumerName', 'STREAMS', 'streamName', '>');
redis.xrevrange('streamName', '+', '-', 'COUNT', 1);
redis.xtrim('streamName', 'MAXLEN', '~', 1000);
// ClusterRetryStrategy can return non-numbers to stop retrying
new Redis.Cluster([], {
clusterRetryStrategy: () => null
});
new Redis.Cluster([], {
clusterRetryStrategy: () => 1
});
+2 -1
View File
@@ -7,6 +7,7 @@
// Shahar Mor <https://github.com/shaharmor>
// Whemoon Jang <https://github.com/palindrom615>
// Francis Gulotta <https://github.com/reconbot>
// Alex Petty <https://github.com/pettyalex>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
@@ -894,7 +895,7 @@ declare namespace IORedis {
}
interface ClusterOptions {
clusterRetryStrategy?(times: number): number;
clusterRetryStrategy?(times: number): number | null;
enableOfflineQueue?: boolean;
enableReadyCheck?: boolean;
scaleReads?: string;
+9
View File
@@ -153,3 +153,12 @@ new Redis.Cluster([{
host: 'localhost',
port: 6379
}]);
// ClusterRetryStrategy can return non-numbers to stop retrying
new Redis.Cluster([], {
clusterRetryStrategy: () => null
});
new Redis.Cluster([], {
clusterRetryStrategy: () => 1
});