Skip to content

Commit

Permalink
revert engine fix
Browse files Browse the repository at this point in the history
  • Loading branch information
josephjclark committed Feb 13, 2025
1 parent beb4617 commit 7adaa1a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
5 changes: 0 additions & 5 deletions .changeset/little-ears-work.md

This file was deleted.

13 changes: 12 additions & 1 deletion packages/engine-multi/src/worker/thread/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import type { SanitizePolicies } from '@openfn/logger';

import { register, publish } from './runtime';
import { execute, createLoggers } from './helpers';
import serializeError from '../../util/serialize-error';
import { JobErrorPayload } from '../../events';

export type RunOptions = {
repoDir: string;
Expand All @@ -15,6 +17,13 @@ export type RunOptions = {
statePropsToRemove?: string[];
};

const eventMap = {
'job-error': (evt: JobErrorPayload) => ({
...evt,
error: serializeError(evt.error),
}),
};

register({
run: (plan: ExecutionPlan, input: State, runOptions: RunOptions) => {
const { repoDir, whitelist, sanitize, statePropsToRemove } = runOptions;
Expand Down Expand Up @@ -52,9 +61,11 @@ register({
// For now I am preloading credentials
// resolveCredential: async (id: string) => {},
notify: (name: NotifyEvents, payload: any) => {
// @ts-ignore
const mappedPayload = eventMap[name]?.(payload) ?? payload;
publish(`worker:${name}`, {
workflowId: plan.id,
...payload,
...mappedPayload,
});
},
},
Expand Down

0 comments on commit 7adaa1a

Please sign in to comment.