From a088e9953ed269af584a5fec6304847690cbf347 Mon Sep 17 00:00:00 2001 From: sjfkai Date: Mon, 19 Dec 2022 14:15:00 +0800 Subject: [PATCH] fix: worker_threads mode without ports (#103) --- lib/utils/mode/impl/worker_threads/app.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/utils/mode/impl/worker_threads/app.js b/lib/utils/mode/impl/worker_threads/app.js index a55becb..85191a9 100644 --- a/lib/utils/mode/impl/worker_threads/app.js +++ b/lib/utils/mode/impl/worker_threads/app.js @@ -156,7 +156,10 @@ class AppUtils extends BaseAppUtils { this.startSuccessCount = 0; const ports = this.options.ports; - this.options.workers = ports.length ? ports.length : 1; + if (!ports.length) { + ports.push(this.options.port); + } + this.options.workers = ports.length; let i = 0; do { const options = Object.assign({}, this.options, { port: ports[i] });