mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
misc
This commit is contained in:
@@ -17,7 +17,12 @@ export class AddressSettingsService {
|
|||||||
public async getSettings(address: string, createIfNotFound: boolean) {
|
public async getSettings(address: string, createIfNotFound: boolean) {
|
||||||
const settings = await this.addressSettingsRepository.findOne({ where: { address } });
|
const settings = await this.addressSettingsRepository.findOne({ where: { address } });
|
||||||
if (createIfNotFound == true && settings == null) {
|
if (createIfNotFound == true && settings == null) {
|
||||||
|
// It's possible to have a race condition here so if we get a PK violation, fetch it
|
||||||
|
try {
|
||||||
return await this.createNew(address);
|
return await this.createNew(address);
|
||||||
|
} catch (e) {
|
||||||
|
return await this.addressSettingsRepository.findOne({ where: { address } });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ export class StratumV1ClientStatistics {
|
|||||||
this.shares = 0;
|
this.shares = 0;
|
||||||
this.acceptedCount = 0;
|
this.acceptedCount = 0;
|
||||||
this.currentTimeSlot = timeSlot;
|
this.currentTimeSlot = timeSlot;
|
||||||
|
this.lastSave = new Date().getTime();
|
||||||
} else if ((date.getTime() - 60 * 1000) > this.lastSave) {
|
} else if ((date.getTime() - 60 * 1000) > this.lastSave) {
|
||||||
await this.clientStatisticsService.update({
|
await this.clientStatisticsService.update({
|
||||||
time: this.currentTimeSlot,
|
time: this.currentTimeSlot,
|
||||||
|
|||||||
Reference in New Issue
Block a user