Skip to content

fix(http): add retry logic to remaining HTTP requests - #381

Merged
spalen0 merged 3 commits into
mainfrom
spark
Sep 25, 2026
Merged

spalen0 merged 3 commits into
mainfrom
spark

Conversation

@spalen0

@spalen0 spalen0 commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Routes the remaining bare requests calls through request_with_retry from utils.http_client, so transient SSL/connection errors, timeouts, 429s and 5xx responses are retried with backoff.

For example, this fixes one-off SSLError(SSLEOFError(... UNEXPECTED_EOF_WHILE_READING ...)) failures from atlas.api.instadapp.io (Fluid). SSLError is a subclass of ConnectionError, so it gets retried.

Updated callers:

  • protocols/spark/proposals.py: Snapshot GraphQL
  • protocols/compound/proposals.py: Tally GraphQL
  • protocols/maker/proposals.py: Sky executive API
  • protocols/fluid/proposals.py: Fluid API
  • protocols/ethena/ethena.py: Ethena transparency API (private fetch_json copy removed, now uses the shared helper)
  • protocols/infinifi/main.py: Infinifi protocol API (now uses the shared fetch_json)
  • protocols/yearn/kong.py: Kong GraphQL API (request failures are wrapped in KongRequestError)
  • utils/tenderly/tenderly.py: Tenderly alerts API

utils/http_client.py:

  • fetch_json now uses request_with_retry, so its callers get retries too: Tenderly simulation, Etherscan source context, Sourcify, Swiss Knife, the calldata decoder and the infinifi LLM context. It still returns None on failure. It now accepts any 2xx response, where before it accepted only 200.
  • request_with_retry logs the status code, URL and the first 200 characters of the response body before raising on a non-retryable 4xx. This keeps the debugging detail that the per-caller error logging used to provide.

Tests have been updated to mock request_with_retry instead of requests.get / requests.post.

🤖 Generated with Claude Code

@spalen0
spalen0 marked this pull request as ready for review September 25, 2026 14:07
Route utils.http_client.fetch_json through request_with_retry, drop the
duplicate ethena fetch_json, and simplify infinifi fetch_api_data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@spalen0 spalen0 changed the title fix(spark): add retry logic to Snapshot GraphQL requests fix(http): add retry logic to remaining HTTP requests Sep 25, 2026
@spalen0
spalen0 merged commit da9c4d4 into main Sep 25, 2026
3 checks passed
@spalen0
spalen0 deleted the spark branch September 25, 2026 15:30
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