mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
bug
This commit is contained in:
@@ -42,6 +42,10 @@ export class ClientStatisticsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async doBulkAsyncUpdate(){
|
public async doBulkAsyncUpdate(){
|
||||||
|
if(this.bulkAsyncUpdates.length < 1){
|
||||||
|
console.log('No client stats to update.')
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Step 1: Prepare data for bulk update
|
// Step 1: Prepare data for bulk update
|
||||||
const values = this.bulkAsyncUpdates.map(stat =>
|
const values = this.bulkAsyncUpdates.map(stat =>
|
||||||
`('${stat.clientId}', ${stat.time}, ${stat.shares ?? 0}, ${stat.acceptedCount ?? 0}, NOW())`
|
`('${stat.clientId}', ${stat.time}, ${stat.shares ?? 0}, ${stat.acceptedCount ?? 0}, NOW())`
|
||||||
@@ -73,6 +77,7 @@ export class ClientStatisticsService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
await this.clientStatisticsRepository.query(query);
|
await this.clientStatisticsRepository.query(query);
|
||||||
|
console.log(`Bulk updated ${this.bulkAsyncUpdates.length} statistics`)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Bulk update failed:', error.message, query);
|
console.error('Bulk update failed:', error.message, query);
|
||||||
throw error;
|
throw error;
|
||||||
|
|||||||
Reference in New Issue
Block a user