Skip to content

Add exponential backoff support to Job.join() polling#129

Merged
ad-m merged 1 commit intomasterfrom
claude/add-polling-backoff-QDnXP
Mar 7, 2026
Merged

Add exponential backoff support to Job.join() polling#129
ad-m merged 1 commit intomasterfrom
claude/add-polling-backoff-QDnXP

Conversation

@ad-m
Copy link
Owner

@ad-m ad-m commented Mar 7, 2026

Summary

Added optional exponential backoff support to the Job.join() method for more efficient polling of task completion. This allows clients to reduce server load by gradually increasing wait times between status checks.

Key Changes

  • Added backoff parameter to Job.join() method (default: False for backward compatibility)
  • When backoff=True, polling intervals start at 1 second and double with each check, capped at 10 seconds
  • When backoff=False, preserves existing behavior with fixed 3-second intervals
  • Backoff works seamlessly with existing features:
    • maximum_time timeout still enforced correctly
    • on_check callback receives accurate cumulative elapsed times
  • Comprehensive test coverage for backoff behavior, timeout handling, and callback integration

Implementation Details

  • Backoff schedule: 1s → 2s → 4s → 8s → 10s → 10s (capped)
  • Elapsed time tracking remains accurate regardless of backoff state
  • No breaking changes to existing API

https://claude.ai/code/session_01635dq7fRyq8VBZr1mgsU9C

Add a `backoff` parameter to `Job.join()` that, when True, starts
polling at 1s and doubles the interval up to a 10s cap. Default
`backoff=False` preserves the existing fixed 3-second interval.

https://claude.ai/code/session_01635dq7fRyq8VBZr1mgsU9C
@ad-m ad-m merged commit 20252da into master Mar 7, 2026
6 of 8 checks passed
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.

2 participants