fix: lock the database when INSERTing a webxdc update

`query_row_optional` does not hold the write lock
and may fail with "database is locked" error
or cause the other task such as SMTP loop to fail.
This commit is contained in:
link2xt
2023-12-01 04:11:33 +00:00
parent f89efd5fce
commit 0e195bc7a2

View File

@@ -409,6 +409,7 @@ impl Context {
instance_id: &MsgId,
status_update_item: &StatusUpdateItem,
) -> Result<Option<StatusUpdateSerial>> {
let _lock = self.sql.write_lock().await;
let uid = status_update_item.uid.as_deref();
let Some(rowid) = self
.sql