Clarify rate-limit retry reset naming

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:
copilot-swe-agent[bot]
2026-03-24 13:58:34 +00:00
parent 8ddea11599
commit 49c9d1feeb

View File

@@ -90,7 +90,7 @@ class Sync < ApplicationRecord
begin
syncable.perform_sync(self)
rescue Provider::TwelveData::RateLimitError
reset_for_retry!
reset_for_rate_limit_retry!
raise
rescue => e
fail!
@@ -107,6 +107,8 @@ class Sync < ApplicationRecord
lock!
# Retry exhaustion can leave the sync in `pending` because we reset it
# after each rate-limit error to make the next ActiveJob retry retryable.
# `fail!` only transitions from `syncing`, so pending syncs need to be
# moved back through `start!` before we can mark them failed.
start! if pending?
fail!
update!(error: error_message)
@@ -164,7 +166,7 @@ class Sync < ApplicationRecord
end
private
def reset_for_retry!
def reset_for_rate_limit_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 TwelveData rate-limit error is being