fix(yearn): retry Envio requests with a 10s per-attempt timeout - #388
Merged
Merged
Conversation
The small parent flow and large flow monitors called Envio via urllib with no retry, so a single transient 504 from the hosted indexer skipped the run and sent an alert (4 of 24 runs on Sep 26-27). Route both through request_with_retry (retries 5xx/429/timeouts with backoff) and cut the per-attempt timeout from 30s to 10s. Small-flow failure alerts now report a short status instead of the raw exception, which would include the Envio endpoint URL. Large-flow now also handles timeouts and connection errors instead of crashing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
yearn-alert-small-parent-flowssentEnvio GraphQL request failed (HTTP Error 504: Gateway Timeout)alerts on 4 of 24 hourly runs (Sep 26 21:05 and 22:05, Sep 27 17:05 and 18:05 UTC). The hosted Envio indexer returned a gateway timeout after 18–36s, and a single failed request skipped the whole run. When I re-ran the same queries with the production saved positions, they finished in 0.1–1.4s, so these are short upstream slowdowns, not a query problem.What changed
alert_small_parent_flows.pyandalert_large_flows.pynow send Envio requests throughutils.http_client.request_with_retry. It retries 5xx errors, 429s, timeouts and connection errors with exponential backoff. The retry work in fix(http): add retry logic to remaining HTTP requests #381 missed these two files because they usedurllibdirectly.HTTP 504 Gateway Timeout,timed out after 10s) rather than the raw exception, which would include the Envio endpoint URL.Tests
pytest: 1401 passed, 6 skipped.ruff checkis clean.mypyreports no new errors.🤖 Generated with Claude Code