Don't reset task lifecycle hooks between executions

This commit is contained in:
Eric Allam
2025-06-20 11:06:58 +01:00
parent 9ab590bead
commit aecee4d35f
2 changed files with 3 additions and 11 deletions
@@ -69,17 +69,6 @@ export class StandardLifecycleHooksManager implements LifecycleHooksManager {
private onCancelHookListeners: (() => Promise<void>)[] = [];
reset(): void {
this.taskInitHooks.clear();
this.taskStartHooks.clear();
this.taskFailureHooks.clear();
this.taskSuccessHooks.clear();
this.taskCompleteHooks.clear();
this.taskResumeHooks.clear();
this.taskCatchErrorHooks.clear();
this.taskMiddlewareHooks.clear();
this.taskCleanupHooks.clear();
this.taskWaitHooks.clear();
this.taskCancelHooks.clear();
this.onCancelHookListeners.length = 0;
this.onWaitHookListeners.length = 0;
this.onResumeHookListeners.length = 0;
@@ -10,6 +10,9 @@ export const helloWorldTask = task({
maxTimeoutInMs: 1000,
factor: 1.5,
},
onStart: async ({ payload, ctx, init }) => {
logger.info("Hello, world from the onStart hook", { payload, init });
},
run: async (payload: any, { ctx }) => {
logger.info("Hello, world from the init", { ctx, payload });
logger.info("env vars", {