feat: use exponential backoff for Pulp task polling#1204
Open
andrewlukoshko wants to merge 1 commit intomasterfrom
Open
feat: use exponential backoff for Pulp task polling#1204andrewlukoshko wants to merge 1 commit intomasterfrom
andrewlukoshko wants to merge 1 commit intomasterfrom
Conversation
Replace the fixed 5-second polling interval in wait_for_task() with exponential backoff starting at 0.5 seconds, doubling each iteration up to a cap of 10 seconds (0.5, 1, 2, 4, 8, 10, 10...). Most Pulp tasks (modify_repository, create content units, file uploads) complete in under 1 second, but the fixed 5s interval meant always waiting at least 5s before detecting completion. With backoff, fast tasks are detected within 0.5s while slow tasks still get reasonable polling intervals. The backoff cap never goes below the caller-provided sleep_time, so callers that explicitly request a longer interval (e.g. create_rpm_publication with sleep_time=30.0 for slow errata publications) are respected. Pulp's own test suite uses 0.5s as its polling interval, and the task status endpoint has no rate limiting, so this is safe.
5bbb418 to
b785d27
Compare
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.
Summary
wait_for_task()with exponential backoff: 0.5s, 1s, 2s, 4s, 8s, 10s, 10s...sleep_time, so explicit long intervals (e.g.sleep_time=30.0for errata publications) are respectedTest plan