Skip to content

Commit 867a566

Browse files
Merge pull request #1 from kofiasare-dev/fix/durably-repeat
Update coordination log after completion for durably_repeat method
1 parent ad9151d commit 867a566

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

lib/chrono_forge/executor/methods/durably_repeat.rb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,13 +219,6 @@ def execute_repetition_now(method, repetition_log, coordination_log, execution_t
219219
completed_at: Time.current
220220
)
221221

222-
# Update coordination log with successful execution and schedule next
223-
coordination_log.update!(
224-
metadata: coordination_log.metadata.merge(
225-
"last_execution_at" => execution_time.iso8601
226-
),
227-
last_executed_at: Time.current
228-
)
229222

230223
schedule_next_execution_after_completion(coordination_log, execution_time, every)
231224
rescue HaltExecutionFlow
@@ -278,6 +271,14 @@ def execute_periodic_method(method, next_execution_at)
278271
end
279272

280273
def schedule_next_execution_after_completion(coordination_log, current_execution_time, every)
274+
# Update coordination log and schedule next
275+
coordination_log.update!(
276+
metadata: coordination_log.metadata.merge(
277+
"last_execution_at" => current_execution_time.iso8601
278+
),
279+
last_executed_at: Time.current
280+
)
281+
281282
# Calculate next execution time
282283
next_execution_time = current_execution_time + every
283284

0 commit comments

Comments
 (0)