You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-06 02:15:48 +03:00
fix reconnecting event (#2396)
* fix #2395 - fix reconnecting event * Update socket.ts
This commit is contained in:
@@ -162,17 +162,15 @@ export default class RedisSocket extends EventEmitter {
|
|||||||
this.#isReady = true;
|
this.#isReady = true;
|
||||||
this.emit('ready');
|
this.emit('ready');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
const retryIn = this.#shouldReconnect(retries, err as Error);
|
const retryIn = this.#shouldReconnect(retries++, err as Error);
|
||||||
if (typeof retryIn !== 'number') {
|
if (typeof retryIn !== 'number') {
|
||||||
throw retryIn;
|
throw retryIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.emit('error', err);
|
this.emit('error', err);
|
||||||
await promiseTimeout(retryIn);
|
await promiseTimeout(retryIn);
|
||||||
|
this.emit('reconnecting');
|
||||||
}
|
}
|
||||||
|
|
||||||
retries++;
|
|
||||||
this.emit('reconnecting');
|
|
||||||
} while (this.#isOpen && !this.#isReady);
|
} while (this.#isOpen && !this.#isReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user