fix(extension): eliminate potential async race condition in slow reconnect by capturing attempt flag synchronously

This commit is contained in:
Timo
2026-05-18 21:37:39 +02:00
parent e3536ad1a7
commit e8203419a3
+4 -1
View File
@@ -204,6 +204,9 @@ async function connect() {
if (isConnecting) return;
isConnecting = true;
const isCurrentSlowRetry = isSlowReconnectAttempt;
isSlowReconnectAttempt = false;
let finalUrl = '';
try {
// --- Phase 1: Storage ---
@@ -235,7 +238,7 @@ async function connect() {
return;
}
if (reconnectFailed && !isSlowReconnectAttempt) {
if (reconnectFailed && !isCurrentSlowRetry) {
isConnecting = false;
scheduleSlowReconnect(); // Keep checking in the background
return;