diff --git a/src/models/StratumV1ClientStatistics.ts b/src/models/StratumV1ClientStatistics.ts index 43ad8e3..5b412b0 100644 --- a/src/models/StratumV1ClientStatistics.ts +++ b/src/models/StratumV1ClientStatistics.ts @@ -44,12 +44,18 @@ export class StratumV1ClientStatistics { if (this.currentTimeSlot == null) { this.currentTimeSlot = timeSlot; - } - - if (this.currentTimeSlot != timeSlot) { await this.clientStatisticsService.insert({ time: this.currentTimeSlot, - clientId: client.id, + shares: this.shares, + acceptedCount: this.acceptedCount, + address: client.address, + clientName: client.clientName, + sessionId: client.sessionId + }); + this.lastSave = new Date().getTime(); + } else if (this.currentTimeSlot != timeSlot) { + await this.clientStatisticsService.insert({ + time: this.currentTimeSlot, shares: this.shares, acceptedCount: this.acceptedCount, address: client.address, @@ -62,7 +68,6 @@ export class StratumV1ClientStatistics { } else if ((date.getTime() - 60 * 1000) > this.lastSave) { await this.clientStatisticsService.update({ time: this.currentTimeSlot, - clientId: client.id, shares: this.shares, acceptedCount: this.acceptedCount, address: client.address,