Skip to content
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

Implement Acquire for PgListener #3561

Closed
wants to merge 1 commit into from

Conversation

chanks
Copy link
Contributor

@chanks chanks commented Oct 13, 2024

I have a binary that mostly listens to notifications for a few channels, then does some work and writes some results back to Postgres when it's done. PgListener already implements Executor, so it's possible to borrow the listener's connection in order to do this for simple writes (and let this binary only use a single PG connection, since they're somewhat expensive and limited), but there's currently not a way to open a transaction via PgListener's connection. So, I implemented Acquire for it.

The test seems a little silly, I guess it's not catching many issues that the type system doesn't, but it felt reasonable to assert that it's actually possible to open up a transaction from the listener's connection.

Thanks! Feedback welcome!

@joeydewaal
Copy link
Contributor

Looks like someone beat you to it (#3550)

@chanks
Copy link
Contributor Author

chanks commented Oct 14, 2024

That's true! I'll just close this one out then, thanks!

@chanks chanks closed this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants