Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
5fb5979c91 | |||
cf61de9093 | |||
cf7c3cb910 | |||
b8eb82de12 |
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@mojoio/bobcat",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.12",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@mojoio/bobcat",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.12",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartnetwork": "^2.0.14",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@mojoio/bobcat",
|
||||
"version": "1.0.10",
|
||||
"version": "1.0.12",
|
||||
"private": false,
|
||||
"description": "a module to talk to bobcat miners",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -8,8 +8,12 @@ export class Bobcat {
|
||||
// STATIC
|
||||
public static async createFromNetworkAddress(networkAddressArg: string) {
|
||||
const newBobcat = new Bobcat(networkAddressArg);
|
||||
await newBobcat.checkMinerStatus().catch();
|
||||
await newBobcat.gatherMinerDetails().catch();
|
||||
try {
|
||||
await newBobcat.checkMinerStatus();
|
||||
await newBobcat.gatherMinerDetails();
|
||||
} catch(err) {
|
||||
console.log('initial adding completed with errors');
|
||||
}
|
||||
return newBobcat;
|
||||
}
|
||||
|
||||
@ -50,6 +54,17 @@ export class Bobcat {
|
||||
await this.gatherMinerDetails();
|
||||
if (this.latestStatus.status !== 'Synced') {
|
||||
console.log(`Miner ${this.latestMinerDetails.animal} is not synced. Restarting now!`);
|
||||
await this.restart().catch();
|
||||
}
|
||||
}
|
||||
|
||||
public async restart() {
|
||||
const response = await plugins.smartrequest.request(`http://${this.networkAddress}/admin/reboot`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: 'Basic ' + Buffer.from('bobcat:miner').toString('base64')
|
||||
}
|
||||
});
|
||||
console.log(response.statusCode);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user