@superhero/core 4.0.1 → 4.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -2
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import os from 'node:os'
|
|
|
2
2
|
import cluster from 'node:cluster'
|
|
3
3
|
import EventEmitter from 'node:events'
|
|
4
4
|
import path from 'node:path'
|
|
5
|
+
import url from 'node:url'
|
|
5
6
|
import bootstrap from '@superhero/bootstrap'
|
|
6
7
|
import Locate from '@superhero/locator'
|
|
7
8
|
import Log from '@superhero/log'
|
|
@@ -331,8 +332,11 @@ export default class Core
|
|
|
331
332
|
this.#isForked = true
|
|
332
333
|
|
|
333
334
|
// Set the worker execution script.
|
|
334
|
-
const
|
|
335
|
-
|
|
335
|
+
const
|
|
336
|
+
pwd = path.dirname(url.fileURLToPath(import.meta.url)),
|
|
337
|
+
primaryClusterConfig = this.config.find('core/cluster/primary', { exec: path.join(pwd, 'worker.js') })
|
|
338
|
+
|
|
339
|
+
cluster.setupPrimary(primaryClusterConfig)
|
|
336
340
|
|
|
337
341
|
for(let i = 0; i < forks; i++)
|
|
338
342
|
{
|