typesense / typesense/typesense-js
Request Cancellation
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 569
- Forks
- 99
- Avg merge
- 5h 6m
- Merged PRs (30d)
- 2
Description
Description
I'd like to be able to abort requests using the AbortController API...
https://developer.mozilla.org/en-US/docs/Web/API/AbortController
Steps to reproduce
This is a feature request not a bug.
Expected Behavior
There'd be some way to pass an AbortController to each underlying axios call in order to cancel an ongoing request before another is made. This not only saves resources but also helps to avoid race conditions where an older request comes back after a newer one (e.g. when typing fast).
https://axios-http.com/docs/cancellation
Actual Behavior
As far as I can tell, there's no way to do this as of right now using things like .collections(...).documents().search(...). I think we'd need to add an optional second argument to anything using ApiCall
Metadata
Typsense Version: SDK v0.12.1 / Server v0.22.2
OS: MacOS
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/Typesense/ApiCall.ts and trace the collections(...).documents().search(...) call path to see how underlying axios calls are made. Define the scope of optional AbortController support across the ApiCall users, then verify that an in-progress request can be cancelled before a newer request is made.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100