Cleaning up after a request #2573
Unanswered
InstinctBas
asked this question in
Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Ok, got a bit of a weird one due to the fact that we're not using connection pooling but opening a connection per request (we're connecting to a PostgreSQL backend).
We don't handle seriously high volumes so the overhead is acceptable and it solves the issue that different requests may be accessing different databases.
In Rocket 0.4 this wasn't much of a problem, request came in, database connection was established in a guard, the guard went out of scope, the connection is cleaned up.
In Rocket 0.5 this changes because the database connection becomes asynchronous and is registered with tokio (tokio::spawn) when its established in the guard. It is now kept and slowly we're filling up with stale connections.
I need to add some sort of cleanup when the guard goes out of scope, anyone has any idea how to approach this?
Beta Was this translation helpful? Give feedback.
All reactions