reduce heartbeat updates

This commit is contained in:
Ben Wilson
2024-01-15 19:47:04 -05:00
parent 982194b4e9
commit 1d6670051f
2 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -516,7 +516,13 @@ export class StratumV1Client {
}
try {
await this.statistics.addShares(this.sessionDifficulty);
await this.clientService.heartbeat(this.entity.address, this.entity.clientName, this.entity.sessionId, this.hashRate);
const now = new Date();
// only update every minute
if (now.getTime() - this.entity.updatedAt.getTime() > 1000 * 60) {
await this.clientService.heartbeat(this.entity.address, this.entity.clientName, this.entity.sessionId, this.hashRate, now);
this.entity.updatedAt = now;
}
} catch (e) {
console.log(e);
const err = new StratumErrorMessage(