You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, so I use a DatabaseConnection in my service that is shared across different tasks by reference (Arc, in particular). I've recently encountered a problem similar to this (https://discord.com/channels/873880840487206962/1059720897939918878) and I need to manually close the connection.
However, I can't just easily do this because close requires an owned value. Also, I've noticed that all branches of close actually just need a reference (if traced to sqlx). So, I think it makes sense to update the implementation to &self instead, considering that other 'write' operations (to the db) are performed by reference and this is the way sqlx does it.
Steps to Reproduce
Arc::new(connection).close().await;
Workarounds
I know that under the hood the sqlx pools have Arc, so it makes sense to try and use owned value (with cloneing as needed). However, it all breaks once mock feature is enabled. I don't want to restrict the usage of mock.
Versions
latest
The text was updated successfully, but these errors were encountered:
Description
Hi, so I use a
DatabaseConnection
in my service that is shared across different tasks by reference (Arc
, in particular). I've recently encountered a problem similar to this (https://discord.com/channels/873880840487206962/1059720897939918878) and I need to manuallyclose
the connection.However, I can't just easily do this because
close
requires an owned value. Also, I've noticed that all branches ofclose
actually just need a reference (if traced tosqlx
). So, I think it makes sense to update the implementation to&self
instead, considering that other 'write' operations (to the db) are performed by reference and this is the way sqlx does it.Steps to Reproduce
Workarounds
I know that under the hood the sqlx pools have
Arc
, so it makes sense to try and use owned value (withclone
ing as needed). However, it all breaks oncemock
feature is enabled. I don't want to restrict the usage ofmock
.Versions
latest
The text was updated successfully, but these errors were encountered: