feat(postgres): support query_timeout dialect option#13258
Merged
Conversation
papb
requested changes
Jun 26, 2021
Member
papb
left a comment
There was a problem hiding this comment.
Hello! I see you are a first-time contributor, thank you for taking the time to help Sequelize! I hope to see more PRs from you in the future!
Can you fix the linting issues? Otherwise this PR is good to be merged :)
query_timeout dialect option
Contributor
Author
|
@papb I have resolved the lint issues |
5 tasks
Member
|
Thanks for your contribution! |
sdepold
approved these changes
Oct 17, 2021
Contributor
|
🎉 This PR is included in version 6.8.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
aliatsis
pushed a commit
to creditiq/sequelize
that referenced
this pull request
Jun 2, 2022
* Add query_timeout option to postgres dialectOptions * fix: lint issues in the test file Co-authored-by: Kamalakannan Jayaraman <kamalakannan.j@brillio.com> Co-authored-by: Sascha Depold <sdepold@users.noreply.github.com>
harrykao
added a commit
to harrykao/sequelize
that referenced
this pull request
Oct 17, 2022
The `query_timeout` feature of the `pg` package helps handle stuck TCP connections more quickly and gracefully by implementing a client-side timeout: brianc/node-postgres#1713 Sequelize started passing this dialect-specific option through to `pg` here: sequelize#13258 I believe we also want to invalidate the connection when a client-side timeout occurs. We shouldn't try to reuse the stuck connection because...it's stuck. This PR updates the error handling code so that the connection is invalidated if the error matches the one thrown from here: https://github.com/brianc/node-postgres/blob/5538df6b446f4b4f921947b460fe38acb897e579/packages/pg/lib/client.js#L529
5 tasks
WikiRik
added a commit
that referenced
this pull request
Oct 24, 2022
* Invalidate connection after client-side timeout. The `query_timeout` feature of the `pg` package helps handle stuck TCP connections more quickly and gracefully by implementing a client-side timeout: brianc/node-postgres#1713 Sequelize started passing this dialect-specific option through to `pg` here: #13258 I believe we also want to invalidate the connection when a client-side timeout occurs. We shouldn't try to reuse the stuck connection because...it's stuck. This PR updates the error handling code so that the connection is invalidated if the error matches the one thrown from here: https://github.com/brianc/node-postgres/blob/5538df6b446f4b4f921947b460fe38acb897e579/packages/pg/lib/client.js#L529 * Add comment with link to PR. * Add tests, shorten comment. * Skip tests for postgres-native. * Update src/dialects/postgres/query.js Co-authored-by: Rik Smale <13023439+WikiRik@users.noreply.github.com> Co-authored-by: Rik Smale <13023439+WikiRik@users.noreply.github.com>
harrykao
added a commit
to harrykao/sequelize
that referenced
this pull request
Nov 15, 2022
Merge ff43e8d from main: The `query_timeout` feature of the `pg` package helps handle stuck TCP connections more quickly and gracefully by implementing a client-side timeout: brianc/node-postgres#1713 Sequelize started passing this dialect-specific option through to `pg` here: sequelize#13258 I believe we also want to invalidate the connection when a client-side timeout occurs. We shouldn't try to reuse the stuck connection because...it's stuck. This PR updates the error handling code so that the connection is invalidated if the error matches the one thrown from here: https://github.com/brianc/node-postgres/blob/5538df6b446f4b4f921947b460fe38acb897e579/packages/pg/lib/client.js#L529
8 tasks
WikiRik
pushed a commit
that referenced
this pull request
Nov 15, 2022
* fix(postgres): invalidate connection after client-side timeout Merge ff43e8d from main: The `query_timeout` feature of the `pg` package helps handle stuck TCP connections more quickly and gracefully by implementing a client-side timeout: brianc/node-postgres#1713 Sequelize started passing this dialect-specific option through to `pg` here: #13258 I believe we also want to invalidate the connection when a client-side timeout occurs. We shouldn't try to reuse the stuck connection because...it's stuck. This PR updates the error handling code so that the connection is invalidated if the error matches the one thrown from here: https://github.com/brianc/node-postgres/blob/5538df6b446f4b4f921947b460fe38acb897e579/packages/pg/lib/client.js#L529 * fix syntax error * fix another syntax error * fix import
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
In this PR, I have added enabled the
dialectOptionsto override the postgres'query_timeoutoption.pgwill close the query request when the query runs more than the configured time limit (in ms).