MCPcopy
hub / github.com/redis/node-redis / setMaintenanceTimeout

Method setMaintenanceTimeout

packages/client/lib/client/socket.ts:296–312  ·  view source on GitHub ↗
(ms?: number)

Source from the content-addressed store, hash-verified

294 }
295
296 setMaintenanceTimeout(ms?: number) {
297 dbgMaintenance(`Set socket timeout to ${ms}`);
298 if (this.#maintenanceTimeout === ms) {
299 dbgMaintenance(`Socket already set maintenanceCommandTimeout to ${ms}, skipping`);
300 return;
301 };
302
303 this.#maintenanceTimeout = ms;
304
305 if(ms !== undefined) {
306 this.#socket?.setTimeout(ms);
307 publish(CHANNELS.CONNECTION_RELAXED_TIMEOUT, () => ({ clientId: this.#clientId, value: 1 }));
308 } else {
309 this.#socket?.setTimeout(this.#socketTimeout ?? 0);
310 publish(CHANNELS.CONNECTION_RELAXED_TIMEOUT, () => ({ clientId: this.#clientId, value: -1 }));
311 }
312 }
313
314 async #createSocket(): Promise<net.Socket | tls.TLSSocket> {
315 const socket = this.#socketFactory.create();

Callers 1

_maintenanceUpdateMethod · 0.80

Calls 2

dbgMaintenanceFunction · 0.90
publishFunction · 0.90

Tested by

no test coverage detected