-
Notifications
You must be signed in to change notification settings - Fork 56
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
Add ScopedPostgresResource
#188
base: main
Are you sure you want to change the base?
Conversation
…e can release the resource with the destructor
I think this goal of this PR makes a lot of sense, but I think this needs a review from someone that's more experienced in C++ than me. @Y-- what do you think about this? Are there easier/better ways to achieve the same? |
This LGTM, a pretty typical use of RAII pattern :-) |
Thanks, then I'll add it to more places as required and undraft 👍 |
Moved this to 0.2.0, in that release we'll do a more holistic approach to solving these issues. |
@Y-- Does this still make sense? Or should we close this one? It seems like you haven't needed this for your cleanup so far? |
Yeah I think something like that still make sense. I'll drive it through or re-implement a similar version when I come to this. |
This PR feels like a continuation of #176 and is also related to #93
When we throw a C++ exception we have to make sure that all postgres related resources get released, this is done through the destructor of the ScopedPostgresResource class
Opening as a draft, hopefully we can talk about the implementation or even alternatives that solve the same issue