-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix: avoid early release of PostgresQueryRunner (#7109) #7185
fix: avoid early release of PostgresQueryRunner (#7109) #7185
Conversation
If the QueryRunner is not connected yet, release is a no-op
Tests are failing on CI, but I don't have access to the results. How can I see what goes wrong? |
You should have access to the CI if you log in with your GitHub account, but otherwise you can run the tests locally with the help of Docker. Here is the error anyway:
|
Revert no-op driver-wide early release, fix only for stream case.
Restrict stream unit test to drivers who implement the stream interface
Restrict unit test to drivers whose stream implementation works in master
Hi @nebkat I resolved the problems with the unit tests. This PR should be ready for review. I could not find in the CONTRIBUTING.md doc any more pointers on who I should add as reviewer, or whether anything else is needed from my side. |
Hi @alvisetrevisan So when do we call |
This is done using the onEnd and onError callback (which ensures that the runner is released only after it's connectd) and is implemented already by the drivers supporting streaming queries. |
Looks correct. Thank you! |
Don't release the queryRunner too early from SelectQueryBuilder when streaming queries.
Description of change
Fixes #7109
In release 0.2.26, streaming queries for postgres were broken. The problem is that SelectQueryBuilder releases the queryRunner too early (when it might not be connected yet), and therefore prevents release at the appropriate moment (using the release callback) to happen (since it will think that it's already released, and quit).
This PR fixes this by delegating the release of the query runner to the stream callback functions, ensuring that it's called when a connection is certainly established.
To test that streaming queries now work again, I had to add
pg-query-stream
to the dev dependencies.The unit test I added fails as expected without this PR's changes, but passes with the changes.
Pull-Request Checklist
master
branchnpm run lint
passes with this changenpm run test
passes with this changeFixes #0000