Skip to content

Commit aecee4d

Browse files
committed
Don't reset task lifecycle hooks between executions
1 parent 9ab590b commit aecee4d

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

packages/core/src/v3/lifecycleHooks/manager.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,6 @@ export class StandardLifecycleHooksManager implements LifecycleHooksManager {
6969
private onCancelHookListeners: (() => Promise<void>)[] = [];
7070

7171
reset(): void {
72-
this.taskInitHooks.clear();
73-
this.taskStartHooks.clear();
74-
this.taskFailureHooks.clear();
75-
this.taskSuccessHooks.clear();
76-
this.taskCompleteHooks.clear();
77-
this.taskResumeHooks.clear();
78-
this.taskCatchErrorHooks.clear();
79-
this.taskMiddlewareHooks.clear();
80-
this.taskCleanupHooks.clear();
81-
this.taskWaitHooks.clear();
82-
this.taskCancelHooks.clear();
8372
this.onCancelHookListeners.length = 0;
8473
this.onWaitHookListeners.length = 0;
8574
this.onResumeHookListeners.length = 0;

references/hello-world/src/trigger/example.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ export const helloWorldTask = task({
1010
maxTimeoutInMs: 1000,
1111
factor: 1.5,
1212
},
13+
onStart: async ({ payload, ctx, init }) => {
14+
logger.info("Hello, world from the onStart hook", { payload, init });
15+
},
1316
run: async (payload: any, { ctx }) => {
1417
logger.info("Hello, world from the init", { ctx, payload });
1518
logger.info("env vars", {

0 commit comments

Comments
 (0)