bm2 1.0.3 → 1.0.5

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.
@@ -57,49 +57,49 @@
57
57
  }
58
58
 
59
59
  async start(options: StartOptions): Promise<ProcessState[]> {
60
- const resolvedInstances = this.clusterManager.resolveInstances(options.instances);
61
- const isCluster = options.execMode === "cluster" || resolvedInstances > 1;
62
- const states: ProcessState[] = [];
63
-
64
- if (isCluster) {
65
- // In cluster mode, each instance is a separate container
66
- for (let i = 0; i < resolvedInstances; i++) {
67
- const id = this.nextId++;
68
- const baseName =
69
- options.name ||
70
- options.script.split("/").pop()?.replace(/\.\w+$/, "") ||
71
- `app-${id}`;
72
- const name = resolvedInstances > 1 ? `${baseName}-${i}` : baseName;
73
-
74
- const config = this.buildConfig(id, name, options, resolvedInstances, i);
75
- const container = new ProcessContainer(
76
- id, config, this.logManager, this.clusterManager,
77
- this.healthChecker, this.cronManager
78
- );
79
-
80
- this.processes.set(id, container);
81
- await container.start();
82
- states.push(container.getState());
83
- }
84
- } else {
85
- const id = this.nextId++;
86
- const name =
87
- options.name ||
88
- options.script.split("/").pop()?.replace(/\.\w+$/, "") ||
89
- `app-${id}`;
90
-
91
- const config = this.buildConfig(id, name, options, 1, 0);
92
- const container = new ProcessContainer(
93
- id, config, this.logManager, this.clusterManager,
94
- this.healthChecker, this.cronManager
95
- );
96
-
97
- this.processes.set(id, container);
98
- await container.start();
99
- states.push(container.getState());
100
- }
101
-
102
- return states;
60
+
61
+ const resolvedInstances = this.clusterManager.resolveInstances(options.instances);
62
+ const isCluster = options.execMode === "cluster" || resolvedInstances > 1;
63
+ const states: ProcessState[] = [];
64
+
65
+ if (isCluster) {
66
+ // In cluster mode, each instance is a separate container
67
+ for (let i = 0; i < resolvedInstances; i++) {
68
+
69
+ const id = this.nextId++;
70
+ const baseName = options.name || options.script.split("/").pop()?.replace(/\.\w+$/, "") || `app-${id}`;
71
+ const name = resolvedInstances > 1 ? `${baseName}-${i}` : baseName;
72
+
73
+ const config = this.buildConfig(id, name, options, resolvedInstances, i);
74
+
75
+ const container = new ProcessContainer(
76
+ id, config, this.logManager, this.clusterManager,
77
+ this.healthChecker, this.cronManager
78
+ );
79
+
80
+ this.processes.set(id, container);
81
+ await container.start();
82
+ states.push(container.getState());
83
+ }
84
+ } else {
85
+ const id = this.nextId++;
86
+ const name =
87
+ options.name ||
88
+ options.script.split("/").pop()?.replace(/\.\w+$/, "") ||
89
+ `app-${id}`;
90
+
91
+ const config = this.buildConfig(id, name, options, 1, 0);
92
+ const container = new ProcessContainer(
93
+ id, config, this.logManager, this.clusterManager,
94
+ this.healthChecker, this.cronManager
95
+ );
96
+
97
+ this.processes.set(id, container);
98
+ await container.start();
99
+ states.push(container.getState());
100
+ }
101
+
102
+ return states;
103
103
  }
104
104
 
105
105
  private buildConfig(