mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
defer some db operations
This commit is contained in:
@@ -359,12 +359,16 @@ export class StratumV1Client {
|
|||||||
|
|
||||||
private async sendNewMiningJob(jobTemplate: IJobTemplate) {
|
private async sendNewMiningJob(jobTemplate: IJobTemplate) {
|
||||||
|
|
||||||
this.hashRate = await this.clientStatisticsService.getHashRateForSession(this.clientAuthorization.address, this.clientAuthorization.worker, this.extraNonceAndSessionId);
|
|
||||||
|
|
||||||
let payoutInformation;
|
let payoutInformation;
|
||||||
const devFeeAddress = this.configService.get('DEV_FEE_ADDRESS');
|
const devFeeAddress = this.configService.get('DEV_FEE_ADDRESS');
|
||||||
//50Th/s
|
//50Th/s
|
||||||
this.noFee = this.hashRate != 0 && this.hashRate < 50000000000000;
|
this.noFee = false;
|
||||||
|
if (this.entity) {
|
||||||
|
this.hashRate = await this.clientStatisticsService.getHashRateForSession(this.clientAuthorization.address, this.clientAuthorization.worker, this.extraNonceAndSessionId);
|
||||||
|
this.noFee = this.hashRate != 0 && this.hashRate < 50000000000000;
|
||||||
|
}
|
||||||
if (this.noFee || devFeeAddress == null || devFeeAddress.length < 1) {
|
if (this.noFee || devFeeAddress == null || devFeeAddress.length < 1) {
|
||||||
payoutInformation = [
|
payoutInformation = [
|
||||||
{ address: this.clientAuthorization.address, percent: 100 }
|
{ address: this.clientAuthorization.address, percent: 100 }
|
||||||
@@ -576,7 +580,7 @@ export class StratumV1Client {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
console.error('Error: Cannot write to closed or ended socket.');
|
console.error(`Error: Cannot write to closed or ended socket. ${this.extraNonceAndSessionId}`);
|
||||||
this.destroy();
|
this.destroy();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -585,7 +589,7 @@ export class StratumV1Client {
|
|||||||
if (!this.socket.destroyed && !this.socket.writableEnded) {
|
if (!this.socket.destroyed && !this.socket.writableEnded) {
|
||||||
await this.socket.end();
|
await this.socket.end();
|
||||||
}
|
}
|
||||||
console.error('Error occurred while writing to socket:', error);
|
console.error(`Error occurred while writing to socket: ${this.extraNonceAndSessionId}`, error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user