bobcat/ts/bobcat.classes.bobcatmanager.ts

28 lines
912 B
TypeScript
Raw Normal View History

2022-02-24 19:16:21 +00:00
import * as plugins from './bobcat.plugins';
2022-02-25 19:36:44 +00:00
import { Bobcat } from './bobcat.classes.bobcat';
2022-02-24 19:16:21 +00:00
/**
*
*/
export class BobcatManager {
2022-02-25 19:36:44 +00:00
public bobcats: Bobcat[] = [];
public async addBobcat(networkAddressArg: string) {
const newBobcat = await Bobcat.createFromNetworkAddress(networkAddressArg);
this.bobcats.push(newBobcat);
2022-02-25 21:45:11 +00:00
console.log(`added ${newBobcat.latestMinerDetails.animal} at ${newBobcat.networkAddress}`);
2022-02-25 19:36:44 +00:00
}
2022-02-25 20:33:24 +00:00
/**
* runs the maintenance on all managed bobcats
*/
public async runMaintenance() {
console.log(`now running maintenance on ${this.bobcats.length} bobcats!`);
2022-02-25 21:45:11 +00:00
console.log(`cooling down for 10 seconds`);
await plugins.smartdelay.delayFor(10000);
2022-02-25 20:33:24 +00:00
for (const bobcat of this.bobcats) {
2022-02-25 21:45:11 +00:00
console.log(`now running maintenance on ${bobcat.latestMinerDetails.animal} at ${bobcat.networkAddress}`);
2022-02-25 20:33:24 +00:00
await bobcat.runMaintenance();
}
};
2022-02-24 19:16:21 +00:00
}