diff --git a/src/ORM/client/client.service.ts b/src/ORM/client/client.service.ts index 318d95b..3829839 100644 --- a/src/ORM/client/client.service.ts +++ b/src/ORM/client/client.service.ts @@ -21,6 +21,17 @@ export class ClientService { return await this.clientRepository.save(client); } + public async insert(partialClient: Partial): Promise { + const insertResult = await this.clientRepository.insert(partialClient); + + const client = { + ...partialClient, + ...insertResult.generatedMaps[0] + }; + + return client as ClientEntity; + } + public async delete(sessionId: string) { return await this.clientRepository.softDelete({ sessionId }); } @@ -87,4 +98,5 @@ export class ClientService { .getRawMany(); return result; } + } \ No newline at end of file diff --git a/src/app.module.ts b/src/app.module.ts index 70067c5..0a220c7 100644 --- a/src/app.module.ts +++ b/src/app.module.ts @@ -40,7 +40,7 @@ const ORMModules = [ cache: true, logging: false, enableWAL: true, - busyTimeout: 60 * 1000 + busyErrorRetry: 60 * 1000 }), CacheModule.register(), ScheduleModule.forRoot(), diff --git a/src/models/StratumV1Client.ts b/src/models/StratumV1Client.ts index 83b77c5..afe2ea6 100644 --- a/src/models/StratumV1Client.ts +++ b/src/models/StratumV1Client.ts @@ -280,12 +280,13 @@ export class StratumV1Client extends EasyUnsubscribe { - this.entity = await this.clientService.save({ + this.entity = await this.clientService.insert({ sessionId: this.extraNonceAndSessionId, address: this.clientAuthorization.address, clientName: this.clientAuthorization.worker, userAgent: this.clientSubscription.userAgent, startTime: new Date(), + bestDifficulty: 0 }); this.stratumV1JobsService.newMiningJob$.pipe(