mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
nerdminer stuff
This commit is contained in:
@@ -27,8 +27,8 @@ export class ClientController {
|
|||||||
return {
|
return {
|
||||||
sessionId: worker.sessionId,
|
sessionId: worker.sessionId,
|
||||||
name: worker.clientName,
|
name: worker.clientName,
|
||||||
bestDifficulty: Math.floor(worker.bestDifficulty),
|
bestDifficulty: worker.bestDifficulty.toFixed(2),
|
||||||
hashRate: Math.floor(await this.clientStatisticsService.getHashRateForSession(worker.address, worker.clientName, worker.sessionId)),
|
hashRate: (await this.clientStatisticsService.getHashRateForSession(worker.address, worker.clientName, worker.sessionId)).toFixed(2),
|
||||||
startTime: worker.startTime
|
startTime: worker.startTime
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
parsedMessage = JSON.parse(message);
|
parsedMessage = JSON.parse(message);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Invalid JSON");
|
console.log("Invalid JSON");
|
||||||
this.promiseSocket.end();
|
await this.promiseSocket.end();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +282,7 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
|
|
||||||
await this.checkDifficulty();
|
await this.checkDifficulty();
|
||||||
|
|
||||||
// await this.watchdog();
|
await this.watchdog();
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -295,10 +295,10 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
}
|
}
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const diffSeconds = (now - time.getTime()) / 1000;
|
const diffSeconds = (now - time.getTime()) / 1000;
|
||||||
// two minutes
|
// five minutes
|
||||||
if (diffSeconds > 120) {
|
if (diffSeconds > 60 * 5) {
|
||||||
console.log('Watchdog ending session');
|
console.log('Watchdog ending session');
|
||||||
this.promiseSocket.end();
|
await this.promiseSocket.end();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { ClientEntity } from '../ORM/client/client.entity';
|
|||||||
|
|
||||||
const CACHE_SIZE = 30;
|
const CACHE_SIZE = 30;
|
||||||
const TARGET_SUBMISSION_PER_SECOND = 10;
|
const TARGET_SUBMISSION_PER_SECOND = 10;
|
||||||
const MIN_DIFF = 1e-9;
|
const MIN_DIFF = 0.000001;
|
||||||
export class StratumV1ClientStatistics {
|
export class StratumV1ClientStatistics {
|
||||||
|
|
||||||
private submissionCacheStart: Date;
|
private submissionCacheStart: Date;
|
||||||
|
|||||||
Reference in New Issue
Block a user