Skip to content

Conversation

julienbourdeau
Copy link
Contributor

@julienbourdeau julienbourdeau commented Oct 15, 2025

If Anrok returns a Bad Gateway error with a 200 status, we handle this by raising a custom Integrations::Aggregator::BadGatewayError. See #3234

This error can be use to retry the job, like for RefreshOngoingBalanceJob

retry_on Net::ReadTimeout, Integrations::Aggregator::BadGatewayError, wait: :polynomially_longer, attempts: 6

Unfortunately, of the error is a return with a 502 status, we'll raise a regular LagoHttpClient::HttpError, which is not retrie

CleanShot 2025-10-15 at 15 50 43@2x

This PR aligns the behavior to always raise this custom error.

Notice that this custom error extends the HttpError:

class BadGatewayError < LagoHttpClient::HttpError

Main changes

  1. refactor tests to use webmock instead of mocking the client
  2. rename BAD_REQUEST_ERROR to BAD_GATEWAY_ERROR
  3. make bad_gateway_error?(e) return true if status is 502 (not just content grepping)
  4. raise BadGatewayError instead of HttpError

@julienbourdeau julienbourdeau self-assigned this Oct 15, 2025
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.

3 participants