Repository navigation
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
AbortSignal.timeout was forwarded from the 1st call to the next ones. When executing a subsequent try fetch, the HTTP request was never sent as the signal had already been aborted
|
|
||
| const fetch = vi.spyOn(globalThis, "fetch"); | ||
|
|
||
| let timeoutCallsCount = 0; |
There was a problem hiding this comment.
note
This seems a bit dirty to count how often the /timeout call is called. Happy to get better suggestions for this
Fixes #637
Bug
When passing
retryandtimeout, if one of the attempted request timed out, the subsequent HTTP calls were never sent. This PR fixes the issueSolution
The bug lied in how the
signaloption was propagated from one attempt to the other. With thetimeoutoption, we were forwarding the full previousAbortSignalwhich included the previousAbortSignal.timeout. If the 1st request had timed out, we are passing to the 2nd request aAbortSignalwhich contained the previous - already aborted -AbortSignal. So the 2nd HTTP request was never sent.Re-creating a
fetchOptionswithout forwarding the wholesignalfrom one attempt to the other fixes the issueSummary by CodeRabbit