Skip to content

Commit 370fa62

Browse files
committedMar 14, 2022
fix: disable slotsRefreshInterval by default
BREAKING CHANGE: `slotsRefreshInterval` is disabled by default, previously, the default value was 5000.
1 parent bb532d2 commit 370fa62

File tree

11 files changed

+760
-751
lines changed

11 files changed

+760
-751
lines changed
 

‎docs/assets/main.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/classes/Cluster.html

+359-359
Large diffs are not rendered by default.

‎docs/classes/default.html

+358-358
Large diffs are not rendered by default.

‎docs/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ioredis</title><meta name="description" content="Documentation for ioredis"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">ioredis</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>ioredis</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Classes</h3><ul class="tsd-index-list"><li class="tsd-kind-class"><a href="classes/Cluster.html" class="tsd-kind-icon">Cluster</a></li><li class="tsd-kind-class"><a href="classes/default.html" class="tsd-kind-icon">default</a></li></ul></section><section class="tsd-index-section "><h3>Interfaces</h3><ul class="tsd-index-list"><li class="tsd-kind-interface"><a href="interfaces/SentinelAddress.html" class="tsd-kind-icon">Sentinel<wbr/>Address</a></li></ul></section><section class="tsd-index-section "><h3>Type aliases</h3><ul class="tsd-index-list"><li class="tsd-kind-type-alias"><a href="index.html#RedisOptions" class="tsd-kind-icon">Redis<wbr/>Options</a></li></ul></section><section class="tsd-index-section "><h3>Variables</h3><ul class="tsd-index-list"><li class="tsd-kind-variable"><a href="index.html#ReplyError" class="tsd-kind-icon">Reply<wbr/>Error</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Type aliases</h2><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="RedisOptions" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Redis<wbr/>Options<a href="#RedisOptions" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Redis<wbr/>Options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">CommonRedisOptions</span><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-type">SentinelConnectionOptions</span><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-type">StandaloneConnectionOptions</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/luin/ioredis/blob/bee46fa/lib/redis/RedisOptions.ts#L37">redis/RedisOptions.ts:37</a></li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group "><h2>Variables</h2><section class="tsd-panel tsd-member tsd-kind-variable"><a id="ReplyError" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> Reply<wbr/>Error<a href="#ReplyError" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Reply<wbr/>Error<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/luin/ioredis/blob/bee46fa/lib/index.ts#L39">index.ts:39</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-class"><a href="classes/Cluster.html" class="tsd-kind-icon">Cluster</a></li><li class="tsd-kind-class"><a href="classes/default.html" class="tsd-kind-icon">default</a></li><li class="tsd-kind-interface"><a href="interfaces/SentinelAddress.html" class="tsd-kind-icon">Sentinel<wbr/>Address</a></li><li class="tsd-kind-type-alias"><a href="index.html#RedisOptions" class="tsd-kind-icon">Redis<wbr/>Options</a></li><li class="tsd-kind-variable"><a href="index.html#ReplyError" class="tsd-kind-icon">Reply<wbr/>Error</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="assets/main.js"></script></body></html>
1+
<!DOCTYPE html><html class="default"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>ioredis</title><meta name="description" content="Documentation for ioredis"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.body.classList.add(localStorage.getItem("tsd-theme") || "os")</script><header><div class="tsd-page-toolbar"><div class="container"><div class="table-wrap"><div class="table-cell" id="tsd-search" data-base="."><div class="field"><label for="tsd-search-field" class="tsd-widget search no-caption">Search</label><input type="text" id="tsd-search-field"/></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">ioredis</a></div><div class="table-cell" id="tsd-widgets"><div id="tsd-filter"><a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a><div class="tsd-filter-group"><div class="tsd-select" id="tsd-filter-visibility"><span class="tsd-select-label">All</span><ul class="tsd-select-list"><li data-value="public">Public</li><li data-value="protected">Public/Protected</li><li data-value="private" class="selected">All</li></ul></div> <input type="checkbox" id="tsd-filter-inherited" checked/><label class="tsd-widget" for="tsd-filter-inherited">Inherited</label></div></div><a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a></div></div></div></div><div class="tsd-page-title"><div class="container"><h1>ioredis</h1></div></div></header><div class="container container-main"><div class="row"><div class="col-8 col-content"><section class="tsd-panel-group tsd-index-group"><h2>Index</h2><section class="tsd-panel tsd-index-panel"><div class="tsd-index-content"><section class="tsd-index-section "><h3>Classes</h3><ul class="tsd-index-list"><li class="tsd-kind-class"><a href="classes/Cluster.html" class="tsd-kind-icon">Cluster</a></li><li class="tsd-kind-class"><a href="classes/default.html" class="tsd-kind-icon">default</a></li></ul></section><section class="tsd-index-section "><h3>Interfaces</h3><ul class="tsd-index-list"><li class="tsd-kind-interface"><a href="interfaces/SentinelAddress.html" class="tsd-kind-icon">Sentinel<wbr/>Address</a></li></ul></section><section class="tsd-index-section "><h3>Type aliases</h3><ul class="tsd-index-list"><li class="tsd-kind-type-alias"><a href="index.html#RedisOptions" class="tsd-kind-icon">Redis<wbr/>Options</a></li></ul></section><section class="tsd-index-section "><h3>Variables</h3><ul class="tsd-index-list"><li class="tsd-kind-variable"><a href="index.html#ReplyError" class="tsd-kind-icon">Reply<wbr/>Error</a></li></ul></section></div></section></section><section class="tsd-panel-group tsd-member-group "><h2>Type aliases</h2><section class="tsd-panel tsd-member tsd-kind-type-alias"><a id="RedisOptions" class="tsd-anchor"></a><h3 class="tsd-anchor-link">Redis<wbr/>Options<a href="#RedisOptions" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Redis<wbr/>Options<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">CommonRedisOptions</span><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-type">SentinelConnectionOptions</span><span class="tsd-signature-symbol"> &amp; </span><span class="tsd-signature-type">StandaloneConnectionOptions</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/luin/ioredis/blob/1fdb918/lib/redis/RedisOptions.ts#L41">redis/RedisOptions.ts:41</a></li></ul></aside></section></section><section class="tsd-panel-group tsd-member-group "><h2>Variables</h2><section class="tsd-panel tsd-member tsd-kind-variable"><a id="ReplyError" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span class="tsd-flag ts-flagConst">Const</span> Reply<wbr/>Error<a href="#ReplyError" aria-label="Permalink" class="tsd-anchor-icon"><svg xmlns="http://www.w3.org/2000/svg" class="icon icon-tabler icon-tabler-link" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"></path><path d="M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"></path></svg></a></h3><div class="tsd-signature tsd-kind-icon">Reply<wbr/>Error<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">any</span><span class="tsd-signature-symbol"> = ...</span></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/luin/ioredis/blob/1fdb918/lib/index.ts#L53">index.ts:53</a></li></ul></aside></section></section></div><div class="col-4 col-menu menu-sticky-wrap menu-highlight"><nav class="tsd-navigation primary"><ul><li class="current"><a href="index.html">Exports</a></li></ul></nav><nav class="tsd-navigation secondary menu-sticky"><ul><li class="tsd-kind-class"><a href="classes/Cluster.html" class="tsd-kind-icon">Cluster</a></li><li class="tsd-kind-class"><a href="classes/default.html" class="tsd-kind-icon">default</a></li><li class="tsd-kind-interface"><a href="interfaces/SentinelAddress.html" class="tsd-kind-icon">Sentinel<wbr/>Address</a></li><li class="tsd-kind-type-alias"><a href="index.html#RedisOptions" class="tsd-kind-icon">Redis<wbr/>Options</a></li><li class="tsd-kind-variable"><a href="index.html#ReplyError" class="tsd-kind-icon">Reply<wbr/>Error</a></li></ul></nav></div></div></div><footer class="with-border-bottom"><div class="container"><h2>Legend</h2><div class="tsd-legend-group"><ul class="tsd-legend"><li class="tsd-kind-constructor tsd-parent-kind-class"><span class="tsd-kind-icon">Constructor</span></li><li class="tsd-kind-property tsd-parent-kind-class"><span class="tsd-kind-icon">Property</span></li><li class="tsd-kind-method tsd-parent-kind-class"><span class="tsd-kind-icon">Method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static property</span></li><li class="tsd-kind-method tsd-parent-kind-class tsd-is-static"><span class="tsd-kind-icon">Static method</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-property tsd-parent-kind-interface"><span class="tsd-kind-icon">Property</span></li></ul><ul class="tsd-legend"><li class="tsd-kind-method tsd-parent-kind-class tsd-is-inherited"><span class="tsd-kind-icon">Inherited method</span></li></ul></div><h2>Settings</h2><p>Theme <select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></p></div></footer><div class="container tsd-generator"><p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div><div class="overlay"></div><script src="assets/main.js"></script></body></html>

‎docs/interfaces/SentinelAddress.html

+1-1
Large diffs are not rendered by default.

‎lib/cluster/ClusterOptions.ts

-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ export const DEFAULT_CLUSTER_OPTIONS: ClusterOptions = {
216216
retryDelayOnClusterDown: 100,
217217
retryDelayOnTryAgain: 100,
218218
slotsRefreshTimeout: 1000,
219-
slotsRefreshInterval: 5000,
220219
useSRVRecords: false,
221220
resolveSrv: resolveSrv,
222221
dnsLookup: lookup,

‎lib/cluster/DelayQueue.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export interface DelayQueueOptions {
1212
* Queue that runs items after specified duration
1313
*/
1414
export default class DelayQueue {
15-
private queues: { [key: string]: any | null } = {};
15+
private queues: { [key: string]: Deque<Function> } = {};
1616
private timeouts: { [key: string]: NodeJS.Timer } = {};
1717

1818
/**

‎lib/cluster/index.ts

+15-20
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,12 @@ class Cluster extends Commander {
255255
this.once("close", closeListener);
256256
this.once("close", this.handleCloseEvent.bind(this));
257257

258-
this.refreshSlotsCache(
259-
function (err) {
260-
if (err && err.message === "Failed to refresh slots cache.") {
261-
Redis.prototype.silentEmit.call(this, "error", err);
262-
this.connectionPool.reset([]);
263-
}
264-
}.bind(this)
265-
);
258+
this.refreshSlotsCache((err) => {
259+
if (err && err.message === ClusterAllFailedError.defaultMessage) {
260+
Redis.prototype.silentEmit.call(this, "error", err);
261+
this.connectionPool.reset([]);
262+
}
263+
});
266264
this.subscriber.start();
267265
})
268266
.catch((err) => {
@@ -431,7 +429,7 @@ class Cluster extends Commander {
431429
function tryNode(index: number) {
432430
if (index === nodes.length) {
433431
const error = new ClusterAllFailedError(
434-
"Failed to refresh slots cache.",
432+
ClusterAllFailedError.defaultMessage,
435433
lastNodeError
436434
);
437435
return wrapper(error);
@@ -699,7 +697,7 @@ class Cluster extends Commander {
699697
}
700698

701699
private resetNodesRefreshInterval() {
702-
if (this.slotsTimer) {
700+
if (this.slotsTimer || !this.options.slotsRefreshInterval) {
703701
return;
704702
}
705703
const nextRound = () => {
@@ -748,16 +746,13 @@ class Cluster extends Commander {
748746
}
749747
if (typeof retryDelay === "number") {
750748
this.setStatus("reconnecting");
751-
this.reconnectTimeout = setTimeout(
752-
() => {
753-
this.reconnectTimeout = null;
754-
debug("Cluster is disconnected. Retrying after %dms", retryDelay);
755-
this.connect().catch(function (err) {
756-
debug("Got error %s when reconnecting. Ignoring...", err);
757-
});
758-
},
759-
retryDelay
760-
);
749+
this.reconnectTimeout = setTimeout(() => {
750+
this.reconnectTimeout = null;
751+
debug("Cluster is disconnected. Retrying after %dms", retryDelay);
752+
this.connect().catch(function (err) {
753+
debug("Got error %s when reconnecting. Ignoring...", err);
754+
});
755+
}, retryDelay);
761756
} else {
762757
this.setStatus("end");
763758
this.flushQueue(new Error("None of startup nodes is available"));

‎lib/errors/ClusterAllFailedError.ts

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import { RedisError } from "redis-errors";
22

33
export default class ClusterAllFailedError extends RedisError {
4+
static defaultMessage = "Failed to refresh slots cache.";
5+
46
constructor(message, public lastNodeError: RedisError) {
57
super(message);
68
Error.captureStackTrace(this, this.constructor);

‎test/functional/cluster/connect.ts

+11-7
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,13 @@ describe("cluster:connect", () => {
145145
new MockServer(30002, argvHandler);
146146
new MockServer(30003, argvHandler);
147147

148-
sinon.stub(Cluster.prototype, "connect").callsFake(() => Promise.resolve());
148+
const stub = sinon
149+
.stub(Cluster.prototype, "connect")
150+
.callsFake(() => Promise.resolve());
149151
const cluster = new Cluster([{ host: "127.0.0.1", port: "30001" }], {
150152
lazyConnect: false,
151153
});
152-
Cluster.prototype.connect.restore();
154+
stub.restore();
153155

154156
cluster.connect().then(() => {
155157
cluster.disconnect();
@@ -158,11 +160,13 @@ describe("cluster:connect", () => {
158160
});
159161

160162
it("should return a promise to be rejected when closed", (done) => {
161-
sinon.stub(Cluster.prototype, "connect").callsFake(() => Promise.resolve());
163+
const stub = sinon
164+
.stub(Cluster.prototype, "connect")
165+
.callsFake(() => Promise.resolve());
162166
const cluster = new Cluster([{ host: "127.0.0.1", port: "30001" }], {
163167
lazyConnect: false,
164168
});
165-
Cluster.prototype.connect.restore();
169+
stub.restore();
166170

167171
cluster.connect().catch(() => {
168172
cluster.disconnect();
@@ -256,7 +260,7 @@ describe("cluster:connect", () => {
256260
new MockServer(30002, argvHandler);
257261

258262
let pending = 2;
259-
let retry: number | false = 0;
263+
let retry: number | null = 0;
260264
var cluster = new Cluster(
261265
[
262266
{ host: "127.0.0.1", port: "30001" },
@@ -265,7 +269,7 @@ describe("cluster:connect", () => {
265269
{
266270
clusterRetryStrategy: () => {
267271
cluster.once("error", function (err) {
268-
retry = false;
272+
retry = null;
269273
expect(err.message).to.eql("Failed to refresh slots cache.");
270274
expect(err.lastNodeError.message).to.eql(errorMessage);
271275
checkDone();
@@ -373,7 +377,7 @@ describe("cluster:connect", () => {
373377
if (!--pending) {
374378
done();
375379
}
376-
return false;
380+
return null;
377381
},
378382
});
379383
cluster.connect().catch((err) => {

‎test/unit/clusters/index.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import * as sinon from "sinon";
44
import { expect } from "chai";
55

66
describe("cluster", () => {
7+
let stub: sinon.SinonStub | undefined;
78
beforeEach(() => {
8-
sinon.stub(Cluster.prototype, "connect").callsFake(() => Promise.resolve());
9+
stub = sinon.stub(Cluster.prototype, "connect");
10+
stub.callsFake(() => Promise.resolve());
911
});
1012

1113
afterEach(() => {
12-
Cluster.prototype.connect.restore();
14+
if (stub) stub.restore();
1315
});
1416

1517
it("should support frozen options", () => {
@@ -35,14 +37,21 @@ describe("cluster", () => {
3537

3638
it("throws when scaleReads is invalid", () => {
3739
expect(() => {
40+
// @ts-expect-error
3841
new Cluster([{}], { scaleReads: "invalid" });
3942
}).to.throw(/Invalid option scaleReads/);
4043
});
4144

45+
it("disables slotsRefreshTimeout by default", () => {
46+
const cluster = new Cluster([{}]);
47+
expect(cluster.options.slotsRefreshInterval).to.eql(undefined);
48+
});
49+
4250
describe("#nodes()", () => {
4351
it("throws when role is invalid", () => {
4452
const cluster = new Cluster([{}]);
4553
expect(() => {
54+
// @ts-expect-error
4655
cluster.nodes("invalid");
4756
}).to.throw(/Invalid role/);
4857
});

0 commit comments

Comments
 (0)
Please sign in to comment.