diff --git a/src/ORM/client-statistics/client-statistics.service.ts b/src/ORM/client-statistics/client-statistics.service.ts index 1d70650..1e19e5c 100644 --- a/src/ORM/client-statistics/client-statistics.service.ts +++ b/src/ORM/client-statistics/client-statistics.service.ts @@ -33,7 +33,14 @@ export class ClientStatisticsService { // } public updateBulkAsync(clientStatistic: Partial) { - this.bulkAsyncUpdates[clientStatistic.client + clientStatistic.time.toString()] = clientStatistic; + const key = clientStatistic.clientId + clientStatistic.time.toString(); + if(this.bulkAsyncUpdates[key] != null){ + this.bulkAsyncUpdates[key].shares = clientStatistic.shares; + this.bulkAsyncUpdates[key].acceptedCount = clientStatistic.acceptedCount; + return; + } + + this.bulkAsyncUpdates[clientStatistic.clientId + clientStatistic.time.toString()] = clientStatistic; } public async doBulkAsyncUpdate(){ diff --git a/src/services/app.service.ts b/src/services/app.service.ts index 1e6217c..0459496 100644 --- a/src/services/app.service.ts +++ b/src/services/app.service.ts @@ -51,7 +51,7 @@ export class AppService implements OnModuleInit { } setInterval(async () => { - console.log('Bulk update client stats'); + //console.log('Bulk update client stats'); await this.clientStatisticsService.doBulkAsyncUpdate(); }, 1000 * 60 * 1);