Skip to content

Commit ecf49dd

Browse files
committed
More callbacks in TaskExecutable
1 parent 55b212b commit ecf49dd

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

app/models/flow_core/task.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def terminate(reason:)
123123
with_transaction_returning_status do
124124
update! stage: :terminated, terminated_at: Time.zone.now, terminate_reason: reason
125125

126+
executable&.on_flow_core_task_terminate(self)
126127
transition.on_task_terminate(self)
127128
instance.on_task_terminate(self)
128129

@@ -158,6 +159,7 @@ def suspend
158159
with_transaction_returning_status do
159160
update! suspended_at: Time.zone.now
160161

162+
executable&.on_flow_core_task_suspend(self)
161163
transition.on_task_suspend(self)
162164
instance.on_task_suspend(self)
163165

@@ -169,6 +171,7 @@ def resume
169171
with_transaction_returning_status do
170172
update! suspended_at: nil, resumed_at: Time.zone.now
171173

174+
executable&.on_flow_core_task_resume(self)
172175
transition.on_task_resume(self)
173176
instance.on_task_resume(self)
174177

lib/flow_core/task_executable.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ def finished?
1515
raise NotImplementedError
1616
end
1717

18+
def on_flow_core_task_terminate(_task); end
19+
20+
def on_flow_core_task_suspend(_task); end
21+
22+
def on_flow_core_task_resume(_task); end
23+
1824
private
1925

2026
def implicit_notify_workflow_task_finished

0 commit comments

Comments
 (0)