Skip to content

Retry bank payment import timeouts every 20 minutes - #171

Merged
thibaudgg merged 1 commit into
masterfrom
cursor/billing-payments-timeout-retries-c14b
Sep 1, 2026
Merged

Retry bank payment import timeouts every 20 minutes#171
thibaudgg merged 1 commit into
masterfrom
cursor/billing-payments-timeout-retries-c14b

Conversation

@thibaudgg

Copy link
Copy Markdown
Member

Overnight BAS HTTP timeouts (CSA Admin production, incident #667) still exhaust Scheduled::BillingPaymentsProcessorJob after 5 attempts. On 1 Sep 2026 for tenant lumieredeschamps, a sample was queued at 04:49 and ran at 05:05 Zurich (~16 minutes) during Billing::BAS#autologin.

Why 20 minutes: the existing 15-minute wait already applies (that 16-minute hop matches 15 minutes plus jitter, not BaseJob’s polynomial ~3s/18s/83s curve). Four intervals still only cover about an hour from the 4am recurring run, and the 5th attempt still timed out. Spacing attempts by 20 minutes (~80 minutes total) gives BAS more time to recover before we discard; the next daily import still picks up any missed payments.

Why the subclass handler must win: Scheduled::BaseJob declares retry_on Exception, wait: :polynomially_longer, attempts: 5. ActiveJob/rescue_from searches last-defined first, so the more specific Net::OpenTimeout / Net::ReadTimeout handler has to stay on the subclass. That is what selects the long wait instead of BaseJob’s short retries. Other exceptions keep the BaseJob behavior.

  • Keep 5 attempts, then discard
  • Update the job test to expect 20–23 minutes (same jitter tolerance as the old 15–18 assertion)
Open in Web Open in Cursor 

Lengthen BillingPaymentsProcessorJob timeout backoff so overnight BAS
outages get more recovery time, and keep that handler on the subclass
so it wins over BaseJob's short Exception retries.

Co-authored-by: Thibaud Guillaume-Gentil <thibaud@thibaud.gg>
@thibaudgg
thibaudgg marked this pull request as ready for review September 1, 2026 06:18
@thibaudgg
thibaudgg merged commit f6bda9b into master Sep 1, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants