@openfn/engine-multi
Advanced tools
Comparing version 1.1.4 to 1.1.5
# engine-multi | ||
## 1.1.5 | ||
### Patch Changes | ||
- Fix an issue where failed steps might not error correctly, stopping the pool from reclaiming the slot | ||
## 1.1.4 | ||
@@ -4,0 +10,0 @@ |
@@ -164,3 +164,3 @@ // src/api.ts | ||
// This pipes the stderr stream onto the child, so we can read it later | ||
stdio: ["ipc", "ignore", "pipe"] | ||
stdio: ["ipc", "pipe", "pipe"] | ||
}); | ||
@@ -324,3 +324,3 @@ logger.debug("pool: Created new child process", child.pid); | ||
const closeWorkers = async (instant) => workers.destroy(instant); | ||
return { callWorker, closeWorkers }; | ||
return { callWorker, closeWorkers, workers }; | ||
} | ||
@@ -716,2 +716,3 @@ | ||
} | ||
let didError = false; | ||
const events = { | ||
@@ -738,2 +739,3 @@ [WORKFLOW_START2]: (evt) => { | ||
[ERROR]: (evt) => { | ||
didError = true; | ||
error(context, { workflowId: state.plan.id, error: evt.error }); | ||
@@ -748,4 +750,6 @@ } | ||
).catch((e) => { | ||
error(context, { workflowId: state.plan.id, error: e }); | ||
logger.error(`Critical error thrown by ${state.plan.id}`, e); | ||
if (!didError) { | ||
error(context, { workflowId: state.plan.id, error: e }); | ||
logger.error(`Critical error thrown by ${state.plan.id}`, e); | ||
} | ||
}); | ||
@@ -776,3 +780,3 @@ } catch (e) { | ||
name: "@openfn/engine-multi", | ||
version: "1.1.4", | ||
version: "1.1.5", | ||
description: "Multi-process runtime engine", | ||
@@ -895,3 +899,3 @@ main: "dist/index.js", | ||
const engine = new Engine(); | ||
const { callWorker, closeWorkers } = initWorkers( | ||
const { callWorker, closeWorkers, workers } = initWorkers( | ||
resolvedWorkerPath, | ||
@@ -967,3 +971,4 @@ { | ||
listen, | ||
destroy | ||
destroy, | ||
workers | ||
}); | ||
@@ -970,0 +975,0 @@ }; |
@@ -150,5 +150,5 @@ // src/worker/thread/run.ts | ||
}; | ||
var execute = async (workflowId, executeFn) => { | ||
var execute = async (workflowId, executeFn, publishFn = publish) => { | ||
const handleError = (err) => { | ||
publish(ERROR, { | ||
publishFn(ERROR, { | ||
// @ts-ignore | ||
@@ -161,2 +161,5 @@ workflowId, | ||
}); | ||
publish(ENGINE_REJECT_TASK, { | ||
error: serialize_error_default(err) | ||
}); | ||
}; | ||
@@ -169,6 +172,10 @@ process2.on("exit", (code) => { | ||
process2.on("uncaughtException", async (err) => { | ||
console.debug(`Uncaught exception in worker thread (workflow ${workflowId} )`); | ||
console.debug( | ||
`Uncaught exception in worker thread (workflow ${workflowId} )` | ||
); | ||
console.debug(err); | ||
try { | ||
console.error(`Uncaught exception in worker thread (workflow ${workflowId} )`); | ||
console.error( | ||
`Uncaught exception in worker thread (workflow ${workflowId} )` | ||
); | ||
console.error(err); | ||
@@ -181,7 +188,4 @@ } catch (e2) { | ||
handleError(e); | ||
setTimeout(() => { | ||
process2.exit(HANDLED_EXIT_CODE); | ||
}, 2); | ||
}); | ||
publish(WORKFLOW_START, { | ||
publishFn(WORKFLOW_START, { | ||
workflowId | ||
@@ -191,3 +195,3 @@ }); | ||
const result = await executeFn(); | ||
publish(WORKFLOW_COMPLETE, { workflowId, state: result }); | ||
publishFn(WORKFLOW_COMPLETE, { workflowId, state: result }); | ||
return result; | ||
@@ -194,0 +198,0 @@ } catch (err) { |
{ | ||
"name": "@openfn/engine-multi", | ||
"version": "1.1.4", | ||
"version": "1.1.5", | ||
"description": "Multi-process runtime engine", | ||
@@ -14,4 +14,4 @@ "main": "dist/index.js", | ||
"@openfn/lexicon": "^1.0.0", | ||
"@openfn/runtime": "1.1.2", | ||
"@openfn/logger": "1.0.1" | ||
"@openfn/logger": "1.0.1", | ||
"@openfn/runtime": "1.1.2" | ||
}, | ||
@@ -18,0 +18,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47270
1320