[mod] have a unique value of reconnection delay
This commit is contained in:
32
app.yml
32
app.yml
@@ -1,4 +1,5 @@
|
||||
connectionTimeout: 10000
|
||||
connectionTimeout: 10000 # 10"
|
||||
waitingDelay: 60000 # 1'
|
||||
ws2pServers:
|
||||
- address: ws://g1-test.cgeek.fr:22001
|
||||
expectedPubkey: 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj
|
||||
@@ -44,32 +45,3 @@ mail:
|
||||
apikey: 6976eb51635b680b832dbe4914524d2c038a13b6
|
||||
from: '"DWatcher" <dwatcher@cgeek.fr>'
|
||||
to: cem.moreau@gmail.com
|
||||
|
||||
reconnectionDelays:
|
||||
- 5000
|
||||
- 10000
|
||||
- 15000
|
||||
- 30000
|
||||
- 60000 # 1'
|
||||
- 300000 # 5'
|
||||
- 600000 # 10'
|
||||
- 900000 # 15'
|
||||
- 1200000 # 20'
|
||||
- 1800000 # 30'
|
||||
- 2400000 # 40'
|
||||
- 3000000 # 50'
|
||||
- 3600000 # 1h
|
||||
- 3600000 # 1h
|
||||
- 3600000 # 1h
|
||||
- 3600000 # 1h
|
||||
- 7200000 # 2h
|
||||
- 7200000 # 2h
|
||||
- 7200000 # 2h
|
||||
- 7200000 # 2h
|
||||
- 14400000 # 4h
|
||||
- 14400000 # 4h
|
||||
- 14400000 # 4h
|
||||
- 14400000 # 4h
|
||||
- 21600000 # 6h
|
||||
- 21600000 # 6h
|
||||
- 43200000 # 12h
|
||||
|
||||
@@ -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