Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hungry-bees-call.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openfn/runtime': patch
---

make sure that notify are properly awaited
5 changes: 5 additions & 0 deletions .changeset/strict-windows-think.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openfn/engine-multi': patch
---

Make publish() async
2 changes: 1 addition & 1 deletion packages/engine-multi/src/worker/thread/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ register({
notify: (name: NotifyEvents, payload: any) => {
// @ts-ignore
const mappedPayload = eventMap[name]?.(payload) ?? payload;
publish(`worker:${name}`, {
return publish(`worker:${name}`, {
workflowId: plan.id,
...mappedPayload,
});
Expand Down
10 changes: 5 additions & 5 deletions packages/runtime/src/execute/step.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const executeStep = async (
const jobName = job.name || job.id;

// The notify events only apply to jobs - not steps - so names don't need to be changed here
notify(NOTIFY_INIT_START, { jobId });
await notify(NOTIFY_INIT_START, { jobId });

// lazy load config and state
const configuration = await loadCredentials(
Expand All @@ -166,7 +166,7 @@ const executeStep = async (
plan.workflow?.credentials
);

notify(NOTIFY_INIT_COMPLETE, {
await notify(NOTIFY_INIT_COMPLETE, {
jobId,
duration: Date.now() - duration,
});
Expand All @@ -182,7 +182,7 @@ const executeStep = async (
const startTime = Date.now();
try {
// TODO include the upstream job?
notify(NOTIFY_JOB_START, { jobId });
await notify(NOTIFY_JOB_START, { jobId });
result = await executeExpression(
ctx,
job.expression!,
Expand Down Expand Up @@ -212,7 +212,7 @@ const executeStep = async (
report(state, jobId, error);

next = calculateNext(step, result, logger);
notify(NOTIFY_JOB_ERROR, {
await notify(NOTIFY_JOB_ERROR, {
duration: Date.now() - startTime,
error,
state,
Expand Down Expand Up @@ -267,7 +267,7 @@ const executeStep = async (
}

next = calculateNext(step, result, logger);
notify(NOTIFY_JOB_COMPLETE, {
await notify(NOTIFY_JOB_COMPLETE, {
duration: Date.now() - duration,
state: result,
jobId,
Expand Down
Loading