[mod] have a unique value of reconnection delay
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export interface Conf {
|
||||
connectionTimeout: number
|
||||
reconnectionDelays: number[]
|
||||
waitingDelay: number
|
||||
ws2pServers: ConfWS2P[]
|
||||
bmaServers: ConfBMA[]
|
||||
dprobeHeartbeats: ConfDprobeHeartbeat[]
|
||||
|
||||
@@ -4,7 +4,7 @@ export function watcherLoop(
|
||||
name: string,
|
||||
connect: () => Promise<void>,
|
||||
onConnectionClosed: () => Promise<void>,
|
||||
reconnectionDelays: number[],
|
||||
waitingDelay: number,
|
||||
onStart: () => Promise<void>,
|
||||
onDisconnection: (waitingDelay: number, error: any) => Promise<void>,
|
||||
onRestart: () => Promise<void>,
|
||||
@@ -46,7 +46,6 @@ export function watcherLoop(
|
||||
watcher.stateFailure(e)
|
||||
}
|
||||
// Wait before reconnecting
|
||||
const waitingDelay = reconnectionDelays[Math.min(reconnectionDelays.length - 1, i)]
|
||||
if (watcher.stateChanged) {
|
||||
// Notify only if state changed since
|
||||
await onDisconnection(waitingDelay, watcher.error)
|
||||
|
||||
@@ -44,7 +44,7 @@ export function urlWatcher(conf: Conf, checkValidity: (data: any) => Promise<Url
|
||||
|
||||
() => nodeDownPromise,
|
||||
|
||||
conf.reconnectionDelays,
|
||||
conf.waitingDelay,
|
||||
|
||||
mail.onEstablished(conf, urlConf.address, getOkTitle()),
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ export function webDiffWatcher(conf: Conf) {
|
||||
|
||||
() => nodeDownPromise,
|
||||
|
||||
conf.reconnectionDelays,
|
||||
conf.waitingDelay,
|
||||
|
||||
() => mail.onEstablished(conf, target, 'webdiff successfully started')(webDiffConf.cc),
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export function ws2pWatcher(conf: Conf) {
|
||||
|
||||
() => c.closed,
|
||||
|
||||
conf.reconnectionDelays,
|
||||
conf.waitingDelay,
|
||||
|
||||
mail.onEstablished(conf, target),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user