Skip to content

feat: use exponential backoff for Pulp task polling#1204

Open
andrewlukoshko wants to merge 1 commit intomasterfrom
exponential-backoff-pulp-task-poll
Open

feat: use exponential backoff for Pulp task polling#1204
andrewlukoshko wants to merge 1 commit intomasterfrom
exponential-backoff-pulp-task-poll

Conversation

@andrewlukoshko
Copy link
Copy Markdown
Member

Summary

  • Replace fixed 5-second polling interval in wait_for_task() with exponential backoff: 0.5s, 1s, 2s, 4s, 8s, 10s, 10s...
  • Most Pulp tasks (modify_repository, create content units, file uploads) complete in <1s but previously always waited 5s before first status check
  • Backoff cap never goes below caller-provided sleep_time, so explicit long intervals (e.g. sleep_time=30.0 for errata publications) are respected
  • Pulp's own test suite uses 0.5s polling — no rate limiting on the task status endpoint

Test plan

  • Full test suite passes (82 passed, 11 skipped)
  • Verify fast Pulp tasks (modify_repository) complete detection in <1s
  • Verify slow tasks (create_rpm_publication with sleep_time=30.0) still poll at 30s intervals
  • Monitor Pulp API load under normal operations to confirm no increase

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.
@andrewlukoshko andrewlukoshko force-pushed the exponential-backoff-pulp-task-poll branch from 5bbb418 to b785d27 Compare April 7, 2026 14:03
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