From 0e195bc7a27b9ebcfe4d0e1a46c0811e65ebccd0 Mon Sep 17 00:00:00 2001 From: link2xt Date: Fri, 1 Dec 2023 04:11:33 +0000 Subject: [PATCH] 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. --- src/webxdc.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/webxdc.rs b/src/webxdc.rs index db9bceea7..c3f5d4e4a 100644 --- a/src/webxdc.rs +++ b/src/webxdc.rs @@ -409,6 +409,7 @@ impl Context { instance_id: &MsgId, status_update_item: &StatusUpdateItem, ) -> Result> { + let _lock = self.sql.write_lock().await; let uid = status_update_item.uid.as_deref(); let Some(rowid) = self .sql