Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
806de97d22 | |||
5ab8115b34 | |||
d761b1459d | |||
26f0ac0508 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/bobcat",
|
"name": "@mojoio/bobcat",
|
||||||
"version": "1.0.20",
|
"version": "1.0.22",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@mojoio/bobcat",
|
"name": "@mojoio/bobcat",
|
||||||
"version": "1.0.20",
|
"version": "1.0.22",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/smartdelay": "^2.0.13",
|
"@pushrocks/smartdelay": "^2.0.13",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@mojoio/bobcat",
|
"name": "@mojoio/bobcat",
|
||||||
"version": "1.0.20",
|
"version": "1.0.22",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "a module to talk to bobcat miners",
|
"description": "a module to talk to bobcat miners",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
|
@ -62,8 +62,14 @@ export class Bobcat {
|
|||||||
*/
|
*/
|
||||||
public async runMaintenance () {
|
public async runMaintenance () {
|
||||||
await plugins.smartpromise.timeoutAndContinue(this.checkMinerStatus());
|
await plugins.smartpromise.timeoutAndContinue(this.checkMinerStatus());
|
||||||
|
await plugins.smartdelay.delayFor(10000);
|
||||||
await plugins.smartpromise.timeoutAndContinue(this.gatherMinerDetails());
|
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());
|
||||||
|
await plugins.smartdelay.delayFor(10000);
|
||||||
|
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!`)
|
console.log(`Miner ${this.latestMinerDetails.animal} at ${this.networkAddress} is Synced. ok!`)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -78,11 +84,24 @@ export class Bobcat {
|
|||||||
if (this.latestStatus.status !== 'Synced') {
|
if (this.latestStatus.status !== 'Synced') {
|
||||||
console.log(`Miner ${this.latestMinerDetails.animal} is not synced. Restarting now!`);
|
console.log(`Miner ${this.latestMinerDetails.animal} is not synced. Restarting now!`);
|
||||||
try {
|
try {
|
||||||
await this.restart()
|
await this.restart();
|
||||||
|
return;
|
||||||
} catch (err) {
|
} 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!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user