[mod] recall of FAILURE state periodically
This commit is contained in:
@@ -5,13 +5,14 @@ export function watcherLoop(
|
||||
connect: () => Promise<void>,
|
||||
onConnectionClosed: () => Promise<void>,
|
||||
waitingDelay: number,
|
||||
recallDelay: number,
|
||||
onStart: () => Promise<void>,
|
||||
onDisconnection: (waitingDelay: number, error: any) => Promise<void>,
|
||||
onDisconnection: (waitingDelay: number, recallDelay: number, error: any) => Promise<void>,
|
||||
onRestart: () => Promise<void>,
|
||||
onRestartSuccess: () => Promise<void>,
|
||||
): Watcher {
|
||||
|
||||
let watcher: Watcher = new Watcher(name)
|
||||
let watcher: Watcher = new Watcher(name, recallDelay)
|
||||
let hasStarted = false
|
||||
|
||||
;(async () => {
|
||||
@@ -48,7 +49,7 @@ export function watcherLoop(
|
||||
// Wait before reconnecting
|
||||
if (watcher.stateChanged) {
|
||||
// Notify only if state changed since
|
||||
await onDisconnection(waitingDelay, watcher.error)
|
||||
await onDisconnection(waitingDelay, recallDelay, watcher.error)
|
||||
}
|
||||
await new Promise(resolve => setTimeout(resolve, waitingDelay))
|
||||
i++
|
||||
|
||||
Reference in New Issue
Block a user