From 26f0ac0508d1671365ec1439886f66f74995c346 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 27 Feb 2022 22:21:35 +0000 Subject: [PATCH] update --- ts/bobcat.classes.bobcat.ts | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ts/bobcat.classes.bobcat.ts b/ts/bobcat.classes.bobcat.ts index 8ea99d9..b08ed17 100644 --- a/ts/bobcat.classes.bobcat.ts +++ b/ts/bobcat.classes.bobcat.ts @@ -62,8 +62,13 @@ export class Bobcat { */ public async runMaintenance () { await plugins.smartpromise.timeoutAndContinue(this.checkMinerStatus()); + await plugins.smartdelay.delayFor(10000); await plugins.smartpromise.timeoutAndContinue(this.gatherMinerDetails()); - if (this.latestStatus.status === 'Synced' && parseInt(this.latestStatus.gap) > -50 && parseInt(this.latestStatus.gap) < 50) { + await plugins.smartdelay.delayFor(10000); + await plugins.smartpromise.timeoutAndContinue(this.checkMinerStatus()); + await plugins.smartdelay.delayFor(10000); + await plugins.smartpromise.timeoutAndContinue(this.gatherMinerDetails()); + if (this.latestStatus.status === 'Synced' && parseInt(this.latestStatus.gap) > -100 && parseInt(this.latestStatus.gap) < 50) { console.log(`Miner ${this.latestMinerDetails.animal} at ${this.networkAddress} is Synced. ok!`) return; } @@ -78,11 +83,24 @@ export class Bobcat { if (this.latestStatus.status !== 'Synced') { console.log(`Miner ${this.latestMinerDetails.animal} is not synced. Restarting now!`); try { - await this.restart() + await this.restart(); + return; } catch (err) { } } + + if (this.latestStatus.status === 'Synced' && parseInt(this.latestStatus.gap) < -100) { + console.log(`Miner ${this.latestMinerDetails.animal} is Synced, but strangely ahead of blockchain. Restarting!`); + try { + await this.restart(); + return; + } catch (err) { + + } + } + + console.log(`Looks like miner ${this.latestMinerDetails.animal} is Synced, but does not fall under predefined statuses!`); } /**