Sync update: 2026-06-20 16:53:51
This commit is contained in:
@@ -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 ─────────────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user