Sync update: 2026-06-20 16:53:51

This commit is contained in:
Hamza-Ayed
2026-06-20 16:53:51 +03:00
parent 10d4651965
commit 9f43eaf8ef
8 changed files with 135 additions and 175 deletions

View File

@@ -182,12 +182,14 @@ class WhatsAppService extends GetxService {
void _scheduleReconnect() {
_reconnectTimer?.cancel();
if (_reconnectCount >= AppConfig.maxReconnectAttempts) {
print('[WS] Max reconnect attempts reached');
return;
}
_reconnectCount++;
_reconnectTimer = Timer(AppConfig.reconnectDelay, connect);
// Progressive backoff: starting at reconnectDelay (3s) up to 15s maximum
final delaySec = (AppConfig.reconnectDelay.inSeconds * (_reconnectCount > 5 ? 5 : _reconnectCount)).clamp(3, 15);
final delay = Duration(seconds: delaySec);
print('[WS] Reconnecting in ${delay.inSeconds} seconds (attempt $_reconnectCount)...');
_reconnectTimer = Timer(delay, connect);
}
// ── Request/Response ─────────────────────────────────────────────────────