4 Commits

Author SHA1 Message Date
cf7c3cb910 1.0.11 2022-02-25 21:45:22 +01:00
b8eb82de12 fix(core): update 2022-02-25 21:45:21 +01:00
8c01d5cabf 1.0.10 2022-02-25 21:35:34 +01:00
1eef97ee9a fix(core): update 2022-02-25 21:35:34 +01:00
5 changed files with 26 additions and 7 deletions

4
package-lock.json generated
View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "@mojoio/bobcat", "name": "@mojoio/bobcat",
"version": "1.0.9", "version": "1.0.11",
"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",

View File

@ -8,11 +8,16 @@ import * as bobcat from '../ts/index';
let testBobcatManager: bobcat.BobcatManager; let testBobcatManager: bobcat.BobcatManager;
let testBobcat: bobcat.Bobcat; let testBobcat: bobcat.Bobcat;
tap.test('first test', async () => { tap.test('should create a bobcat manager', async () => {
testBobcatManager = new bobcat.BobcatManager(); testBobcatManager = new bobcat.BobcatManager();
expect(testBobcatManager).toBeInstanceOf(bobcat.BobcatManager); expect(testBobcatManager).toBeInstanceOf(bobcat.BobcatManager);
}); });
tap.test('should create a bobcat', async () => {
testBobcat = new bobcat.Bobcat('bobcat.bleu.de');
expect(testBobcat).toBeInstanceOf(bobcat.Bobcat);
})
tap.test('should add a Bobcat miner', async () => { tap.test('should add a Bobcat miner', async () => {
const bobcatAddresses = testQenv.getEnvVarOnDemand('BOBCATS').split(','); const bobcatAddresses = testQenv.getEnvVarOnDemand('BOBCATS').split(',');
console.log(bobcatAddresses); console.log(bobcatAddresses);
@ -22,9 +27,8 @@ tap.test('should add a Bobcat miner', async () => {
} }
}); });
tap.test('', async () => { tap.test('should run maintenance on bobcats', async () => {
testBobcat = new bobcat.Bobcat('bobcat.bleu.de'); await testBobcatManager.runMaintenance();
expect(testBobcat).toBeInstanceOf(bobcat.Bobcat);
}) })
tap.start(); tap.start();

View File

@ -50,6 +50,17 @@ export class Bobcat {
await this.gatherMinerDetails(); await this.gatherMinerDetails();
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!`);
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);
}
} }

View File

@ -21,4 +21,8 @@ export class BobcatManager {
await bobcat.runMaintenance(); await bobcat.runMaintenance();
} }
}; };
public async restart() {
}
} }