spread out reconnects between 2 and 5 min
This commit is contained in:
parent
852b4571b3
commit
26625a58d0
|
@ -179,7 +179,7 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
|||
} catch { }
|
||||
|
||||
if (!this.connected) {
|
||||
this.reconnectTimer = setTimeout(() => this.reconnect(sync), 120000);
|
||||
this.reconnectTimer = setTimeout(() => this.reconnect(sync), this.random(120000, 300000));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,4 +189,10 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private random(min: number, max: number) {
|
||||
min = Math.ceil(min);
|
||||
max = Math.floor(max);
|
||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue