Skip to content

fix(retry): handle Retry-After zero delay#5519

Open
Ram-blip wants to merge 1 commit into
nodejs:mainfrom
Ram-blip:fix/retry-after-zero
Open

fix(retry): handle Retry-After zero delay#5519
Ram-blip wants to merge 1 commit into
nodejs:mainfrom
Ram-blip:fix/retry-after-zero

Conversation

@Ram-blip

@Ram-blip Ram-blip commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This relates to...

Fixes the default retry handler so Retry-After: 0 is treated as a valid zero-delay retry instead of falling back to minTimeout.

Rationale

Retry-After delay-seconds can be zero. The current retry timeout selection only uses the parsed header value when it is greater than zero, so Retry-After: 0 falls through to the exponential backoff fallback.

This change adds an explicit zero-delay branch and changes invalid HTTP-date parsing to return null instead of 0, so invalid dates continue to use the fallback path.

Changes

  • Preserve Retry-After: 0 as a zero-delay retry.
  • Keep invalid Retry-After date values on the fallback retry path.
  • Add a fake-timer regression test for the zero-delay case.

Features

N/A

Bug Fixes

Fixes default retry handling for Retry-After: 0.

Breaking Changes and Deprecations

N/A

Status

Signed-off-by: Ram-blip <ramcruze2000@gmail.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.44%. Comparing base (cb4c2f1) to head (0cd0daf).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5519   +/-   ##
=======================================
  Coverage   93.44%   93.44%           
=======================================
  Files         110      110           
  Lines       37328    37330    +2     
=======================================
+ Hits        34881    34884    +3     
+ Misses       2447     2446    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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