Skip to content

persona: retry transient 5xx on api requests - #345

Open
leowilkin wants to merge 1 commit into
mainfrom
fix/persona-api-retry-transient-5xx
Open

leowilkin wants to merge 1 commit into
mainfrom
fix/persona-api-retry-transient-5xx

Conversation

@leowilkin

Copy link
Copy Markdown
Member

what

the persona api client now retries 502/503/504 up to twice (0.5s, then 1s backoff), matching what the file download connection already does.

why

sentry caught a 503 from persona while fetching a selfie verification during inquiry.approved. save_inquiry_data rescues per-verification Persona::APIErrors, so the job carried on and built the identity document from the gov id photos alone. once a document exists, ensure_inquiry_data_saved never refetches, so a single blip permanently drops the liveness photos.

faraday-retry only retries idempotent methods by default, so inquiry creation (post) is never double-sent. after retries run out the last response still reaches request! and raises Persona::APIError as before.

not covered

  • the verification from the sentry event still has a document without selfie photos. it needs a manual backfill.
  • an outage longer than the retry window still drops the selfie silently. failing the job on a missing selfie would be a sturdier follow-up.

tests

two new specs in api_service_spec.rb: a 503 followed by a 200 succeeds on the second request, and repeated 503s raise after 3 requests.

a 503 on the selfie lookup was rescued and dropped, and since the
gov id photos still produced a document, the selfie was never
refetched. the file download connection already retried 5xx; the
api connection now does too (idempotent methods only).
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.

1 participant