mirror of
https://github.com/benjamin-wilson/public-pool.git
synced 2026-09-29 09:05:06 -07:00
optimize startup
This commit is contained in:
+1
-1
@@ -40,7 +40,7 @@ const ORMModules = [
|
|||||||
cache: true,
|
cache: true,
|
||||||
logging: false,
|
logging: false,
|
||||||
enableWAL: true,
|
enableWAL: true,
|
||||||
busyTimeout: 30 * 1000
|
busyTimeout: 60 * 1000
|
||||||
}),
|
}),
|
||||||
CacheModule.register(),
|
CacheModule.register(),
|
||||||
ScheduleModule.forRoot(),
|
ScheduleModule.forRoot(),
|
||||||
|
|||||||
@@ -60,13 +60,6 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.sessionStart = new Date();
|
|
||||||
|
|
||||||
this.statistics = new StratumV1ClientStatistics(this.clientStatisticsService);
|
|
||||||
this.extraNonceAndSessionId = this.getRandomHexString();
|
|
||||||
|
|
||||||
console.log(`New client ID: : ${this.extraNonceAndSessionId}`);
|
|
||||||
|
|
||||||
this.promiseSocket.socket.on('data', (data: Buffer) => {
|
this.promiseSocket.socket.on('data', (data: Buffer) => {
|
||||||
data.toString()
|
data.toString()
|
||||||
.split('\n')
|
.split('\n')
|
||||||
@@ -80,6 +73,11 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.sessionStart = new Date();
|
||||||
|
this.statistics = new StratumV1ClientStatistics(this.clientStatisticsService);
|
||||||
|
this.extraNonceAndSessionId = this.getRandomHexString();
|
||||||
|
console.log(`New client ID: : ${this.extraNonceAndSessionId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getRandomHexString() {
|
private getRandomHexString() {
|
||||||
@@ -100,7 +98,6 @@ export class StratumV1Client extends EasyUnsubscribe {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log("Invalid JSON");
|
console.log("Invalid JSON");
|
||||||
this.promiseSocket.socket.emit('end', true);
|
this.promiseSocket.socket.emit('end', true);
|
||||||
console.error(e);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ export class StratumV1Service implements OnModuleInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private startSocketServer() {
|
private startSocketServer() {
|
||||||
new Server({ allowHalfOpen: true }, async (s: Socket) => {
|
new Server(async (s: Socket) => {
|
||||||
|
|
||||||
const promiseSocket = new PromiseSocket(s);
|
const promiseSocket = new PromiseSocket(s);
|
||||||
|
|
||||||
@@ -56,11 +56,6 @@ export class StratumV1Service implements OnModuleInit {
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const clientCount = await this.clientService.connectedClientCount();
|
|
||||||
|
|
||||||
console.log(`New client connected: ${promiseSocket.socket.remoteAddress}, ${clientCount} total clients`);
|
|
||||||
|
|
||||||
promiseSocket.socket.on('end', async (error: Error) => {
|
promiseSocket.socket.on('end', async (error: Error) => {
|
||||||
// Handle socket disconnection
|
// Handle socket disconnection
|
||||||
client.destroy();
|
client.destroy();
|
||||||
|
|||||||
Reference in New Issue
Block a user