codehooks-js 1.3.21 → 1.3.22
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/package.json +1 -1
- package/workflow/engine.mjs +9 -2
package/package.json
CHANGED
package/workflow/engine.mjs
CHANGED
|
@@ -466,12 +466,19 @@ class Workflow extends EventEmitter {
|
|
|
466
466
|
async registerWithApp(app, name, description, definition) {
|
|
467
467
|
this.emit('workflowCreated', { name, description });
|
|
468
468
|
|
|
469
|
+
// Log current configuration state at registration time
|
|
470
|
+
console.debug('Workflow registration config:', {
|
|
471
|
+
defaultWorkers: this.#defaultStepOptions.workers,
|
|
472
|
+
stepsConfig: this.#steps
|
|
473
|
+
});
|
|
474
|
+
|
|
469
475
|
// Validate each step in the definition
|
|
470
476
|
for (const [stepName, step] of Object.entries(definition)) {
|
|
471
477
|
try {
|
|
472
478
|
// Skip null, undefined, or invalid step names
|
|
473
479
|
if (stepName !== undefined && stepName !== null && stepName !== 'null' && stepName.trim() !== '') {
|
|
474
|
-
|
|
480
|
+
const workerCount = this.getWorkersForStep(stepName);
|
|
481
|
+
console.debug('registering queue for step', `${this.#queuePrefix}_${name}_${stepName}`, { workers: workerCount, stepConfig: this.#steps[stepName] });
|
|
475
482
|
app.worker(`${this.#queuePrefix}_${name}_${stepName}`, async (req, res) => {
|
|
476
483
|
try {
|
|
477
484
|
const { stepsName, goto, state, instanceId, options } = req.body.payload;
|
|
@@ -492,7 +499,7 @@ class Workflow extends EventEmitter {
|
|
|
492
499
|
//console.debug('Worker res.end', stepName);
|
|
493
500
|
res.end();
|
|
494
501
|
}
|
|
495
|
-
});
|
|
502
|
+
}, { workers: workerCount });
|
|
496
503
|
}
|
|
497
504
|
} catch (error) {
|
|
498
505
|
console.error(`Invalid step definition '${stepName}': ${error.message}`);
|