[mod] e-mails plus explicites (titre + motif erreur)
This commit is contained in:
@@ -6,10 +6,9 @@ export function watcherLoop(
|
||||
onConnectionClosed: () => Promise<void>,
|
||||
reconnectionDelays: number[],
|
||||
onStart: () => Promise<void>,
|
||||
onDisconnection: (waitingDelay: number) => Promise<void>,
|
||||
onDisconnection: (waitingDelay: number, error: any) => Promise<void>,
|
||||
onRestart: () => Promise<void>,
|
||||
onRestartSuccess: () => Promise<void>,
|
||||
onError: (e: Error) => Promise<void>,
|
||||
): Watcher {
|
||||
|
||||
let watcher: Watcher = new Watcher(name)
|
||||
@@ -44,12 +43,11 @@ export function watcherLoop(
|
||||
await onConnectionClosed()
|
||||
|
||||
} catch (e) {
|
||||
await onError(e)
|
||||
watcher.stateFailure(e && e.message || e)
|
||||
watcher.stateFailure(e)
|
||||
}
|
||||
// Wait before reconnecting
|
||||
const waitingDelay = reconnectionDelays[Math.min(reconnectionDelays.length - 1, i)]
|
||||
await onDisconnection(waitingDelay)
|
||||
await onDisconnection(waitingDelay, watcher.error)
|
||||
await new Promise(resolve => setTimeout(resolve, waitingDelay))
|
||||
i++
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user