mirror of
https://github.com/chatmail/core.git
synced 2026-05-04 05:46:29 +03:00
sql: replace .get_conn() interface with .call()
.call() interface is safer because it ensures that blocking operations on SQL connection are called within tokio::task::block_in_place(). Previously some code called blocking operations in async context, e.g. add_parts() in receive_imf module. The underlying implementation of .call() can later be replaced with an implementation that does not require block_in_place(), e.g. a worker pool, without changing the code using the .call() interface.
This commit is contained in:
@@ -186,7 +186,7 @@ impl Peerstate {
|
||||
async fn from_stmt(
|
||||
context: &Context,
|
||||
query: &str,
|
||||
params: impl rusqlite::Params,
|
||||
params: impl rusqlite::Params + Send,
|
||||
) -> Result<Option<Peerstate>> {
|
||||
let peerstate = context
|
||||
.sql
|
||||
|
||||
Reference in New Issue
Block a user