Make query cancellation more consistent
- Dominant language
- TypeScript
- Stars
- 481
- Forks
- 108
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 7
Description
The current implementation of the query cancellation logic is duplicated in multiple endpoints and is quite cumbersome.
## Potential Solution
* Move logic to Express middleware
* Add cancel endpoint and call from client
### Express middleware
This would be a good option to remove the duplication of logic and to abstract the code to a single place. This would keep the existing behavior of watching when the request is interrupted.
### Cancel endpoint
This would be a different approach than what we do now. Arguably this is simpler and more expressive.
* Client sends fetch request with query id and abort signal
* If abort signal is triggered, then send fetch request to cancel endpoint as a fire and forget
Personally, I prefer this approach.
Contributor guide
Research direction
Start by tracing the duplicated query-cancellation logic in the endpoints and the client fetch request, focusing on the query id and abort signal. Compare the proposed Express middleware and cancel endpoint approaches, then verify that the chosen design preserves cancellation when a request is interrupted and removes the duplicated behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- express, typescript
- Domain
- api, backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100