[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:
|
ws2pServers:
|
||||||
- address: ws://g1-test.cgeek.fr:22001
|
- address: ws://g1-test.cgeek.fr:22001
|
||||||
expectedPubkey: 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj
|
expectedPubkey: 3dnbnYY9i2bHMQUGyFp5GVvJ2wBkVpus31cDJA5cfRpj
|
||||||
@@ -44,32 +45,3 @@ mail:
|
|||||||
apikey: 6976eb51635b680b832dbe4914524d2c038a13b6
|
apikey: 6976eb51635b680b832dbe4914524d2c038a13b6
|
||||||
from: '"DWatcher" <dwatcher@cgeek.fr>'
|
from: '"DWatcher" <dwatcher@cgeek.fr>'
|
||||||
to: cem.moreau@gmail.com
|
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 {
|
export interface Conf {
|
||||||
connectionTimeout: number
|
connectionTimeout: number
|
||||||
reconnectionDelays: number[]
|
waitingDelay: number
|
||||||
ws2pServers: ConfWS2P[]
|
ws2pServers: ConfWS2P[]
|
||||||
bmaServers: ConfBMA[]
|
bmaServers: ConfBMA[]
|
||||||
dprobeHeartbeats: ConfDprobeHeartbeat[]
|
dprobeHeartbeats: ConfDprobeHeartbeat[]
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export function watcherLoop(
|
|||||||
name: string,
|
name: string,
|
||||||
connect: () => Promise<void>,
|
connect: () => Promise<void>,
|
||||||
onConnectionClosed: () => Promise<void>,
|
onConnectionClosed: () => Promise<void>,
|
||||||
reconnectionDelays: number[],
|
waitingDelay: number,
|
||||||
onStart: () => Promise<void>,
|
onStart: () => Promise<void>,
|
||||||
onDisconnection: (waitingDelay: number, error: any) => Promise<void>,
|
onDisconnection: (waitingDelay: number, error: any) => Promise<void>,
|
||||||
onRestart: () => Promise<void>,
|
onRestart: () => Promise<void>,
|
||||||
@@ -46,7 +46,6 @@ export function watcherLoop(
|
|||||||
watcher.stateFailure(e)
|
watcher.stateFailure(e)
|
||||||
}
|
}
|
||||||
// Wait before reconnecting
|
// Wait before reconnecting
|
||||||
const waitingDelay = reconnectionDelays[Math.min(reconnectionDelays.length - 1, i)]
|
|
||||||
if (watcher.stateChanged) {
|
if (watcher.stateChanged) {
|
||||||
// Notify only if state changed since
|
// Notify only if state changed since
|
||||||
await onDisconnection(waitingDelay, watcher.error)
|
await onDisconnection(waitingDelay, watcher.error)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export function urlWatcher(conf: Conf, checkValidity: (data: any) => Promise<Url
|
|||||||
|
|
||||||
() => nodeDownPromise,
|
() => nodeDownPromise,
|
||||||
|
|
||||||
conf.reconnectionDelays,
|
conf.waitingDelay,
|
||||||
|
|
||||||
mail.onEstablished(conf, urlConf.address, getOkTitle()),
|
mail.onEstablished(conf, urlConf.address, getOkTitle()),
|
||||||
|
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export function webDiffWatcher(conf: Conf) {
|
|||||||
|
|
||||||
() => nodeDownPromise,
|
() => nodeDownPromise,
|
||||||
|
|
||||||
conf.reconnectionDelays,
|
conf.waitingDelay,
|
||||||
|
|
||||||
() => mail.onEstablished(conf, target, 'webdiff successfully started')(webDiffConf.cc),
|
() => mail.onEstablished(conf, target, 'webdiff successfully started')(webDiffConf.cc),
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ export function ws2pWatcher(conf: Conf) {
|
|||||||
|
|
||||||
() => c.closed,
|
() => c.closed,
|
||||||
|
|
||||||
conf.reconnectionDelays,
|
conf.waitingDelay,
|
||||||
|
|
||||||
mail.onEstablished(conf, target),
|
mail.onEstablished(conf, target),
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user