MCPcopy
hub / github.com/redis/node-redis / #shouldReconnect

Method #shouldReconnect

packages/client/lib/client/socket.ts:208–233  ·  view source on GitHub ↗
(retries: number, cause: Error)

Source from the content-addressed store, hash-verified

206 }
207
208 #shouldReconnect(retries: number, cause: Error) {
209 const retryIn = this.#reconnectStrategy(retries, cause);
210 if (retryIn === false) {
211 this.#isOpen = false;
212 publish(CHANNELS.ERROR, () => ({
213 error: cause,
214 origin: 'client',
215 internal: false,
216 clientId: this.#clientId
217 }));
218 this.emit('error', cause);
219 return cause;
220 } else if (retryIn instanceof Error) {
221 this.#isOpen = false;
222 publish(CHANNELS.ERROR, () => ({
223 error: cause,
224 origin: 'client',
225 internal: false,
226 clientId: this.#clientId
227 }));
228 this.emit('error', cause);
229 return new ReconnectStrategyError(retryIn, cause);
230 }
231
232 return retryIn;
233 }
234
235 async connect(): Promise<void> {
236 if (this.#isOpen) {

Callers 2

#connectMethod · 0.95
#onSocketErrorMethod · 0.95

Calls 1

publishFunction · 0.90

Tested by

no test coverage detected