From de1bdac35f50fb233b8e6696948624c76544ec98 Mon Sep 17 00:00:00 2001 From: siiky Date: Thu, 28 Nov 2024 11:55:22 +0000 Subject: [PATCH] fix: poll on `networkDown` --- lib/brain.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/brain.js b/lib/brain.js index e859c7485..17cb28f9f 100644 --- a/lib/brain.js +++ b/lib/brain.js @@ -232,9 +232,10 @@ Brain.prototype.traderRun = function traderRun () { .then(_ => this.trader.poll()) .finally(() => { this.pollHandle = setVariableInterval( - () => this.state === 'networkDown' ? - this.trader.clearConfigVersion() : - this.trader.poll() , + () => { + if (this.state === 'networkDown') this.trader.clearConfigVersion() + return this.trader.poll() + }, ACTIVE_POLL_INTERVAL, res => (res || this.networkDown) ? ACTIVE_POLL_INTERVAL : IDLE_POLL_INTERVAL )