Skip to content

feat(SQO): Introduce circuit breaker. #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Jun 26, 2025

Conversation

MoonBoi9001
Copy link
Member

@MoonBoi9001 MoonBoi9001 commented Jun 26, 2025

Problem statement

The SQO can enter an endless loop of restarts due to the current configuration. For example, if we have an issue with our RPC providers, that will not be resolved on retrying, then we can end up with an endless loop of the service failing, restarting, re-querying BigQuery and reattempting to post a transaction on-chain. This loop is expensive and pointless furthermore it may not be caught for hours.

Key changes

  • Introduce the src/utils/circuit_breaker.py module who's functions are called to record service failures, if the service fails too many times in a short duration (default is 3 failures in 60 mins) then we exit with error code 0, so the service is prevented from an endless loop of restarts, which could be expensive in BigQuery. An engineer can then take a look at the underlying issue and solve the problem if this failure mode were to ever arrise.
  • Change docker service to restart "on failure" from restart "always", the circuit breaker module can stops the restart if conditions are triggered.
  • Introduce documentation on the use of the new circuit breaker /docs/technical-design.md inside the codebase.
  • Update slack notifications so we know which rpc was used when we successfully post a transaction on-chain.
  • Upgraded dependancies to newer versions, upgrded python to v3.11, tested compatibility and verified that service works.
  • Update blockchain client to use the latest version of the w3 library as existing code was incompatible with latest w3
  • Update tests for compatibility with latest code

@MoonBoi9001 MoonBoi9001 changed the title draft feat(SQO): Introduce circuit breaker. Jun 26, 2025
@MoonBoi9001 MoonBoi9001 marked this pull request as ready for review June 26, 2025 22:00
@MoonBoi9001 MoonBoi9001 merged commit 62ef969 into main Jun 26, 2025
9 checks passed
@MoonBoi9001 MoonBoi9001 deleted the update-reqs,-tests,-docs,-and-confirm-runs branch June 26, 2025 22:00
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