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
Abort DB operations / Transaction using AbortSignal #8552
Comments
I'm not sure if this can be implemented before Node.js and TypeORM drop support for Node 12 (last version without |
Node 12's Maintenance support ends on 2022-04-30 (66 days from now). Work on this feature could begin now and wait to be merged until after Node 12's EOL, since it is relatively near. |
What do you think about placing it in Eg. class QueryBuilder {
execute(options?: {signal: AbortSignal});
}
``` |
Don't you think |
I'm not sure about that. Can you provide links to existing fluent interfaces using |
Every place that I see there isn't any fluent interface around Is still any plan to support this feature? |
It would be a super helpful feature to optimize performance, especially for systems (like ours) that run heavy analytical queries. Do you know if this feature is in the library roadmap? |
Providing signal to execute seems better for three reasons
Is someone implementing this? I volunteer to take a look and comeback with estimations or a pr if it is fast |
Feature Description
The Problem
Aborting DB operations is useful when the user abort some request when the DB operation is no longer needed (e.g. getting result for autocomplete and then the user type more characters (this is not my use case but rather a common use case that need the abort feature))
The Solution
Using
AbortSignal
to abort DB operation and transaction.There are 2 approaches I have in mind:
I prefer the 1st option as it keep the library usage design
Usage
Repository
andEntityManager
QueryBuilder
Transactions
Using Connection or EntityManager:
Using
QueryRunner
:Using decorators:
How this should be used? Maybe can set the abort signal on the passed manager
Passing the signal to the DB transaction will abort the transaction when the signal abort emit, passing
Considered Alternatives
Additional Context
StackOverflow question I've opened about this
Cancel transactions sequelize/sequelize#11395
Relevant Database Driver(s)
All of them basically
Are you willing to resolve this issue by submitting a Pull Request?
The text was updated successfully, but these errors were encountered: