mirror of
https://github.com/chatmail/core.git
synced 2026-05-08 01:16:31 +03:00
fix(message): make markseen_msgs async compatible
Otherwise this method can not be called from an actually spawned async method, as `PreparedStatement` is `!Send`
This commit is contained in:
committed by
GitHub
parent
57870ec54a
commit
e22a9999d7
@@ -1417,6 +1417,7 @@ pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()>
|
|||||||
}
|
}
|
||||||
|
|
||||||
let conn = context.sql.get_conn().await?;
|
let conn = context.sql.get_conn().await?;
|
||||||
|
let msgs = async_std::task::spawn_blocking(move || -> Result<_> {
|
||||||
let mut stmt = conn.prepare_cached(concat!(
|
let mut stmt = conn.prepare_cached(concat!(
|
||||||
"SELECT",
|
"SELECT",
|
||||||
" m.chat_id AS chat_id,",
|
" m.chat_id AS chat_id,",
|
||||||
@@ -1444,6 +1445,9 @@ pub async fn markseen_msgs(context: &Context, msg_ids: Vec<MsgId>) -> Result<()>
|
|||||||
}
|
}
|
||||||
drop(stmt);
|
drop(stmt);
|
||||||
drop(conn);
|
drop(conn);
|
||||||
|
Ok(msgs)
|
||||||
|
})
|
||||||
|
.await?;
|
||||||
|
|
||||||
let mut updated_chat_ids = BTreeMap::new();
|
let mut updated_chat_ids = BTreeMap::new();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user