modified: src/entity/instance/on_demand.ts

This commit is contained in:
zhangyuheng 2023-12-15 15:03:23 +08:00
parent 5cc32ac826
commit cb8910b337

View File

@ -83,6 +83,10 @@ export class OnDemandRunner {
await new Promise<void>((ok) => { await new Promise<void>((ok) => {
const net = require('net'); const net = require('net');
for (const port of this.ports) { for (const port of this.ports) {
if (!port.port) {
logger.error(`${this.instance.instanceUuid} not available port found `, port);
continue;
}
const server = net.createServer(); const server = net.createServer();
server.listen(port.port); server.listen(port.port);
logger.info(`${this.instance.instanceUuid} socket listing on `, port.port); logger.info(`${this.instance.instanceUuid} socket listing on `, port.port);
@ -105,6 +109,7 @@ export class OnDemandRunner {
resolve(); resolve();
} catch (error) { } catch (error) {
reject(error); reject(error);
this.instance.runOnDemand();
} }
}); });
} }