-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support timeout
and AbortController
#268
Conversation
changed default timeoutExponent function to not increase over retries.
Codecov Report
@@ Coverage Diff @@
## main #268 +/- ##
==========================================
+ Coverage 91.75% 92.10% +0.35%
==========================================
Files 5 5
Lines 473 494 +21
Branches 79 85 +6
==========================================
+ Hits 434 455 +21
Misses 39 39
|
Hello, sorry for possible mistakes in README.md, if this feature will be moved on check documentation, thanks. |
timeout
and AbortController
Thanks for the nice PR dear @picunada β€οΈ I have made few refactors to keep the feature simple (we might think about using interceptors to have advanced usages like exponential timeout increase) also exposing |
@@ -184,6 +194,13 @@ export function createFetch(globalOptions: CreateFetchOptions = {}): $Fetch { | |||
} | |||
} | |||
|
|||
// TODO: Can we merge signals? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I propose that we support both the provided signal from the user and a timeout mechanism, allowing them to work alongside each other. In my use case, I need a specific request timeout of 15 seconds, as well as a signal to cancel the request when the component's unmounted hook is triggered. These two functionalities serve entirely different purposes and should be handled separately.
And it seems manageable:
https://github.com/jacobheun/any-signal
π Linked issue
Issue #21
β Type of change
π Description
Added timeout feature.
Added timeoutExponent parameter to specify function to increase timeout over retries.
Added test for new feature.
Added documentation for new feature(maybe need fixes, sorry for my english).
π Checklist