Add exponential backoff to reactive consumer retries#680
Merged
Conversation
Copilot
AI
changed the title
[WIP] Add exponential backoff to reactive consumer
Add exponential backoff to reactive consumer retries
Dec 16, 2025
cbartz
reviewed
Dec 16, 2025
github-runner-manager/src/github_runner_manager/reactive/consumer.py
Outdated
Show resolved
Hide resolved
github-runner-manager/src/github_runner_manager/reactive/consumer.py
Outdated
Show resolved
Hide resolved
cbartz
reviewed
Dec 16, 2025
Contributor
Author
cbartz
approved these changes
Dec 16, 2025
weiiwang01
approved these changes
Dec 16, 2025
florentianayuwono
approved these changes
Dec 17, 2025
Co-authored-by: cbartz <4182921+cbartz@users.noreply.github.com>
Co-authored-by: cbartz <4182921+cbartz@users.noreply.github.com>
…o 60s Co-authored-by: cbartz <4182921+cbartz@users.noreply.github.com>
Co-authored-by: cbartz <4182921+cbartz@users.noreply.github.com>
Co-authored-by: cbartz <4182921+cbartz@users.noreply.github.com>
Co-authored-by: cbartz <4182921+cbartz@users.noreply.github.com>
663fed4 to
55a0e29
Compare
…retries' into copilot/add-exponential-backoff-retries
cbartz
reviewed
Dec 17, 2025
Contributor
TICS Quality Gate✔️ Passedgithub-runner-operatorSee the results in the TICS Viewer The following files have been checked for this project
|
javierdelapuente
approved these changes
Dec 17, 2025
yanksyoon
approved these changes
Dec 17, 2025
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.
Applicable spec: N/A
Overview
Replaces static 60-second retry sleep in reactive consumer with exponential backoff (60s base, 1800s cap) to reduce load on dependencies during sustained failures.
Also: Update CODEOWNERS to reflect current team.
Rationale
Static retry delays cause a problem where sustained failures hammer dependencies with consistent 60s intervals. Exponential backoff progressively increases delays, reducing API load during prolonged outages while maintaining the same initial retry delay. The backoff is capped at 1800 seconds (30 minutes) to prevent excessively long delays.
Juju Events Changes
None.
Module Changes
github_runner_manager/reactive/consumer.py:BACKOFF_BASE_SECONDS = 60constantBACKOFF_MAX_SECONDS = 1800constant_calculate_backoff_time(retry_count)helper implementingbase × 2^(retry_count-1)capped at 1800sget_queue_size()following code organization conventionsconsume()to use exponential backoff for message retries (whenmsg_process_count > 1)_spawn_runner()unchanged - continues using 60s polling intervalWAIT_TIME_IN_SECconstant retained for use in_spawn_runner()Backoff schedule (capped at 1800s):
Note: With
RETRY_LIMIT = 5, the maximum backoff experienced is 960s (16 minutes) before message rejection.Tests:
_calculate_backoff_time()covering retry counts and 1800s capDocumentation:
docs/changelog.mdwith entry for 2025-12-16 documenting the exponential backoff featuregithub-runner-manager/pyproject.tomlLibrary Changes
None.
Checklist
urgent,trivial,complex).github-runner-manager/pyproject.toml.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.