fix(core): update

This commit is contained in:
Philipp Kunz 2022-02-27 22:36:17 +01:00
parent cbc3334994
commit db8f587d8d

View File

@ -38,7 +38,7 @@ export class Bobcat {
*/ */
public async checkMinerStatus () { public async checkMinerStatus () {
const response = await plugins.smartrequest.getJson(`http://${this.networkAddress}/status.json`, { const response = await plugins.smartrequest.getJson(`http://${this.networkAddress}/status.json`, {
timeout: 30000 timeout: 60000
}); });
const body: interfaces.IMinerStatus = response.body; const body: interfaces.IMinerStatus = response.body;
this.latestStatus = body; this.latestStatus = body;
@ -50,7 +50,7 @@ export class Bobcat {
*/ */
public async gatherMinerDetails () { public async gatherMinerDetails () {
const response = await plugins.smartrequest.getJson(`http://${this.networkAddress}/miner.json`, { const response = await plugins.smartrequest.getJson(`http://${this.networkAddress}/miner.json`, {
timeout: 30000 timeout: 60000
}); });
const body: interfaces.IMinerDetailsResponse = response.body; const body: interfaces.IMinerDetailsResponse = response.body;
this.latestMinerDetails = body; this.latestMinerDetails = body;
@ -61,8 +61,8 @@ export class Bobcat {
* runs maintenance on the bobcat * runs maintenance on the bobcat
*/ */
public async runMaintenance () { public async runMaintenance () {
await this.checkMinerStatus(); await plugins.smartpromise.timeoutAndContinue(this.checkMinerStatus());
await this.gatherMinerDetails(); await plugins.smartpromise.timeoutAndContinue(this.gatherMinerDetails());
if (this.latestStatus.status === 'Synced' && parseInt(this.latestStatus.gap) > -50 && parseInt(this.latestStatus.gap) < 50) { if (this.latestStatus.status === 'Synced' && parseInt(this.latestStatus.gap) > -50 && 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;
@ -103,7 +103,7 @@ export class Bobcat {
await plugins.smartdelay.delayFor(10000); await plugins.smartdelay.delayFor(10000);
const response = await plugins.smartrequest.request(`http://${this.networkAddress}/admin/reboot`, { const response = await plugins.smartrequest.request(`http://${this.networkAddress}/admin/reboot`, {
method: 'POST', method: 'POST',
timeout: 30000, timeout: 60000,
...Bobcat.minerAuthObject ...Bobcat.minerAuthObject
}); });
console.log(response.statusCode); console.log(response.statusCode);