mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
insert optimizations
This commit is contained in:
@@ -21,6 +21,17 @@ export class ClientService {
|
|||||||
return await this.clientRepository.save(client);
|
return await this.clientRepository.save(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async insert(partialClient: Partial<ClientEntity>): Promise<ClientEntity> {
|
||||||
|
const insertResult = await this.clientRepository.insert(partialClient);
|
||||||
|
|
||||||
|
const client = {
|
||||||
|
...partialClient,
|
||||||
|
...insertResult.generatedMaps[0]
|
||||||
|
};
|
||||||
|
|
||||||
|
return client as ClientEntity;
|
||||||
|
}
|
||||||
|
|
||||||
public async delete(sessionId: string) {
|
public async delete(sessionId: string) {
|
||||||
return await this.clientRepository.softDelete({ sessionId });
|
return await this.clientRepository.softDelete({ sessionId });
|
||||||
}
|
}
|
||||||
@@ -87,4 +98,5 @@ export class ClientService {
|
|||||||
.getRawMany();
|
.getRawMany();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+1
-1
@@ -40,7 +40,7 @@ const ORMModules = [
|
|||||||
cache: true,
|
cache: true,
|
||||||
logging: false,
|
logging: false,
|
||||||
enableWAL: true,
|
enableWAL: true,
|
||||||
busyTimeout: 60 * 1000
|
busyErrorRetry: 60 * 1000
|
||||||
}),
|
}),
|
||||||
CacheModule.register(),
|
CacheModule.register(),
|
||||||
ScheduleModule.forRoot(),
|
ScheduleModule.forRoot(),
|
||||||
|
|||||||
@@ -280,12 +280,13 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.entity = await this.clientService.save({
|
this.entity = await this.clientService.insert({
|
||||||
sessionId: this.extraNonceAndSessionId,
|
sessionId: this.extraNonceAndSessionId,
|
||||||
address: this.clientAuthorization.address,
|
address: this.clientAuthorization.address,
|
||||||
clientName: this.clientAuthorization.worker,
|
clientName: this.clientAuthorization.worker,
|
||||||
userAgent: this.clientSubscription.userAgent,
|
userAgent: this.clientSubscription.userAgent,
|
||||||
startTime: new Date(),
|
startTime: new Date(),
|
||||||
|
bestDifficulty: 0
|
||||||
});
|
});
|
||||||
|
|
||||||
this.stratumV1JobsService.newMiningJob$.pipe(
|
this.stratumV1JobsService.newMiningJob$.pipe(
|
||||||
|
|||||||
Reference in New Issue
Block a user