mirror of
https://github.com/we-promise/sure.git
synced 2026-05-12 15:15:01 +00:00
Clarify sync retry state transitions
Co-authored-by: jjmata <187772+jjmata@users.noreply.github.com> Agent-Logs-Url: https://github.com/we-promise/sure/sessions/ea7a06f4-8344-4a00-877a-eda8cdfdc16a
This commit is contained in:
@@ -105,7 +105,7 @@ class Sync < ApplicationRecord
|
||||
def fail_for_retry_exhaustion!(error_message)
|
||||
Sync.transaction do
|
||||
lock!
|
||||
start! if may_start?
|
||||
start! if pending?
|
||||
fail! if may_fail?
|
||||
update!(error: error_message)
|
||||
end
|
||||
@@ -163,6 +163,9 @@ class Sync < ApplicationRecord
|
||||
|
||||
private
|
||||
def reset_for_retry!
|
||||
# We intentionally bypass callbacks/state events here so the same sync record
|
||||
# can become retryable again without firing post-sync hooks or extra
|
||||
# transition side effects while the job is being retried.
|
||||
update_columns(
|
||||
status: "pending",
|
||||
error: nil,
|
||||
|
||||
Reference in New Issue
Block a user