mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-08-10 03:27:34 +00:00
fix(extension): eliminate potential async race condition in slow reconnect by capturing attempt flag synchronously
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user