multi port

This commit is contained in:
Benjamin Wilson
2024-09-07 23:56:09 -04:00
parent ff6d446c12
commit fb8715c23d
2 changed files with 9 additions and 6 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ BITCOIN_RPC_TIMEOUT=10000
# BITCOIN_ZMQ_HOST="tcp://192.168.1.100:3000" # BITCOIN_ZMQ_HOST="tcp://192.168.1.100:3000"
API_PORT=3334 API_PORT=3334
STRATUM_PORT=3333 STRATUM_PORTS=3333,3332,3331,3330
#optional telegram bot #optional telegram bot
#TELEGRAM_BOT_TOKEN= #TELEGRAM_BOT_TOKEN=
+8 -5
View File
@@ -33,12 +33,15 @@ export class StratumV1Service implements OnModuleInit {
if (process.env.NODE_APP_INSTANCE == '0') { if (process.env.NODE_APP_INSTANCE == '0') {
await this.clientService.deleteAll(); await this.clientService.deleteAll();
} }
this.startSocketServer(); setTimeout(() => {
process.env.STRATUM_PORTS.split(',').forEach(port =>{
this.startSocketServer(parseInt(port));
});
}, 1000 * 10)
} }
private startSocketServer() { private startSocketServer(port: number) {
const server = new Server(async (socket: Socket) => { const server = new Server(async (socket: Socket) => {
//10 min //10 min
@@ -78,8 +81,8 @@ export class StratumV1Service implements OnModuleInit {
}); });
server.listen(process.env.STRATUM_PORT, () => { server.listen(port, () => {
console.log(`Stratum server is listening on port ${process.env.STRATUM_PORT}`); console.log(`Stratum server is listening on port ${port}`);
}); });
} }