2 Commits

Author SHA1 Message Date
45544fffd0 1.0.9 2022-02-25 21:33:24 +01:00
f227eaee37 fix(core): update 2022-02-25 21:33:24 +01:00
4 changed files with 26 additions and 5 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@mojoio/bobcat",
"version": "1.0.8",
"version": "1.0.9",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@mojoio/bobcat",
"version": "1.0.8",
"version": "1.0.9",
"license": "MIT",
"dependencies": {
"@pushrocks/smartnetwork": "^2.0.14",

View File

@ -1,6 +1,6 @@
{
"name": "@mojoio/bobcat",
"version": "1.0.8",
"version": "1.0.9",
"private": false,
"description": "a module to talk to bobcat miners",
"main": "dist_ts/index.js",

View File

@ -8,8 +8,8 @@ export class Bobcat {
// STATIC
public static async createFromNetworkAddress(networkAddressArg: string) {
const newBobcat = new Bobcat(networkAddressArg);
await newBobcat.gatherMinerDetails();
await newBobcat.checkMinerStatus();
await newBobcat.checkMinerStatus().catch();
await newBobcat.gatherMinerDetails().catch();
return newBobcat;
}
@ -41,4 +41,15 @@ export class Bobcat {
this.latestMinerDetails = body;
return this.latestMinerDetails;
}
/**
* runs maintenance on the bobcat
*/
public async runMaintenance() {
await this.checkMinerStatus();
await this.gatherMinerDetails();
if (this.latestStatus.status !== 'Synced') {
console.log(`Miner ${this.latestMinerDetails.animal} is not synced. Restarting now!`);
}
}
}

View File

@ -11,4 +11,14 @@ export class BobcatManager {
const newBobcat = await Bobcat.createFromNetworkAddress(networkAddressArg);
this.bobcats.push(newBobcat);
}
/**
* runs the maintenance on all managed bobcats
*/
public async runMaintenance() {
console.log(`now running maintenance on ${this.bobcats.length} bobcats!`);
for (const bobcat of this.bobcats) {
await bobcat.runMaintenance();
}
};
}