Skip to content

Fix compute_next_delay returning None when max_retry_interval is not set#116

Merged
YunchuWang merged 2 commits intomainfrom
wangbill/fix-retry-without-max-interval
Feb 27, 2026
Merged

Fix compute_next_delay returning None when max_retry_interval is not set#116
YunchuWang merged 2 commits intomainfrom
wangbill/fix-retry-without-max-interval

Conversation

@YunchuWang
Copy link
Member

Problem

The compute_next_delay() method in RetryableTask returns None when max_retry_interval is not set (the default configuration). This causes retries to silently not happen for the most common RetryPolicy configuration.

Fix

Moved the return timedelta(seconds=next_delay_f) statement outside the if max_retry_interval is not None block so the computed delay is always returned.

Tests

Added two new tests to cover the previously-untested code path:

  • test_activity_retry_without_max_retry_interval
  • test_activity_retry_with_default_backoff

YunchuWang and others added 2 commits February 26, 2026 20:42
The compute_next_delay() method in RetryableTask had a bug where the
return statement for the computed delay was inside the
'if max_retry_interval is not None' block. When max_retry_interval was
not set (the default), the method would fall through and return None,
causing retries to silently not happen.

This fix moves the return statement outside the max_retry_interval
check so the delay is always returned after optional capping.

Added two new tests:
- test_activity_retry_without_max_retry_interval: verifies retry with
  exponential backoff works when max_retry_interval is not set
- test_activity_retry_with_default_backoff: verifies retry with default
  backoff_coefficient (1.0) produces constant delays
@YunchuWang YunchuWang merged commit 71f7e4e into main Feb 27, 2026
20 checks passed
@YunchuWang YunchuWang deleted the wangbill/fix-retry-without-max-interval branch February 27, 2026 18:22
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