Skip to content

Commit

Permalink
fix #2395 - fix reconnecting event
Browse files Browse the repository at this point in the history
  • Loading branch information
leibale committed Jan 28, 2023
1 parent 58e572b commit f6a9a3b
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/client/lib/client/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,16 @@ export default class RedisSocket extends EventEmitter {
this.#isReady = true;
this.emit('ready');
} catch (err) {
const retryIn = this.#shouldReconnect(retries, err as Error);
const retryIn = this.#shouldReconnect(retries++, err as Error);
if (typeof retryIn !== 'number') {
throw retryIn;
}

this.emit('error', err);
await promiseTimeout(retryIn);

this.emit('reconnecting');
}

retries++;
this.emit('reconnecting');
} while (this.#isOpen && !this.#isReady);
}

Expand Down

0 comments on commit f6a9a3b

Please sign in to comment.