Skip to content

Commit cbd3fc4

Browse files
clear redis connection promise on error
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent 0d34829 commit cbd3fc4

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

react_on_rails_pro/spec/dummy/client/app/utils/redisReceiver.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,15 @@ export function listenToRequestData(requestId: string): RequestListener {
6666

6767
// Start connection if not already in progress
6868
if (!connectionPromise) {
69-
connectionPromise = redisClient.connect().then(() => {
70-
isClientConnected = true;
71-
connectionPromise = null; // Clear after successful connection
72-
});
69+
connectionPromise = redisClient.connect()
70+
.then(() => {
71+
isClientConnected = true;
72+
connectionPromise = null; // Clear after successful connection
73+
})
74+
.catch((error) => {
75+
connectionPromise = null; // Clear on error to allow retry
76+
throw error; // Re-throw to propagate error
77+
});
7378
}
7479

7580
// Wait for connection to complete (handles concurrent calls)

0 commit comments

Comments
 (0)