getSuggestedDifficulty bug

This commit is contained in:
Ben Wilson
2023-08-06 22:41:25 -04:00
parent 0a9c254e84
commit 1172ab5971
5 changed files with 38 additions and 36 deletions
+2 -5
View File
@@ -36,11 +36,8 @@ export class AppService implements OnModuleInit {
}
}
@Cron(CronExpression.EVERY_5_MINUTES)
@Cron(CronExpression.EVERY_SECOND)
private async killDeadClients() {
if (process.env.NODE_APP_INSTANCE == null || process.env.NODE_APP_INSTANCE == '0') {
await this.clientService.killDeadClients();
}
await this.clientService.killDeadClients();
}
}
+9 -17
View File
@@ -58,28 +58,20 @@ export class StratumV1Service implements OnModuleInit {
socket.on('end', async (error: Error) => {
// Handle socket disconnection
client.destroy();
await this.clientService.delete(client.extraNonceAndSessionId);
const clientCount = await this.clientService.connectedClientCount();
console.log(`Client disconnected, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
if (client.extraNonceAndSessionId != null) {
// Handle socket disconnection
await client.destroy();
console.log(`Client disconnected, ${client.extraNonceAndSessionId}`);
}
});
socket.on('error', async (error: Error) => {
client.destroy();
await this.clientService.delete(client.extraNonceAndSessionId);
const clientCount = await this.clientService.connectedClientCount();
console.log(`Client disconnected, socket error, ${client.extraNonceAndSessionId}, ${clientCount} total clients`);
if (client.extraNonceAndSessionId != null) {
await client.destroy();
console.log(`Client disconnected, socket error, ${client.extraNonceAndSessionId}`);
}
socket.destroy();
});
});