This repository was archived by the owner on Sep 30, 2024. It is now read-only.
feat/msp: use pgxpool instead of pgx.Conn#62994
Merged
Merged
Conversation
unknwon
approved these changes
May 31, 2024
unknwon
left a comment
Contributor
There was a problem hiding this comment.
FYI asks for a stdlib interface from pgx would give you the pool (because of the stdlib semantics).
Member
Author
|
This is true, but at least release registry has expressed interest in using pgx directly, and as we're a postgres-only shop I wonder if it might be better to use pgx directly |
Contributor
I think in practice it makes no difference, just different coding patterns. With that said, 10 years ago, |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
During manual testing for https://github.com/sourcegraph/sourcegraph/pull/62934, I started realizing that I would run into database errors:
Turns out,
pgx.Connis meant for non-concurrent use. What we really want is a connection pool, with an off-the-shelf offering frompgxpool.Test plan
Integration tests pass, now with more cases using
t.Parallel(). Also ran a quick sanity check by hand:Changelog
lib/managedservicesplatform/contract.Contract'sConnectToDatabase(...)has been renamed toGetConnectionPool(...), and now returns a*pgxpool.Poolinstead of a*pgx.Connlib/managedservicesplatform/cloudsqlhelper library'sConnect(...)has been renamed toGetConnectionPool(...), and now returns a*pgxpool.Poolinstead of a*pgx.Conn