From 3abac991f0877fc4d36dcb9c01ef5c23d6f70e28 Mon Sep 17 00:00:00 2001 From: JustMe Date: Fri, 2 Oct 2026 11:12:05 +0800 Subject: [PATCH] fix(storage): defer concurrent SQLite read transactions --- server/src/WebDrop.Storage/SqliteChannelStore.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/WebDrop.Storage/SqliteChannelStore.cs b/server/src/WebDrop.Storage/SqliteChannelStore.cs index 84ddf2a..ca8951c 100644 --- a/server/src/WebDrop.Storage/SqliteChannelStore.cs +++ b/server/src/WebDrop.Storage/SqliteChannelStore.cs @@ -38,7 +38,8 @@ public sealed class SqliteChannelStore : IResourceStore, IDisposable { using var conn = Open(); // 显式事务让一次 Read 内的多条查询看到同一份快照 - using var tx = conn.BeginTransaction(); + // 读事务延迟到首次访问时才取快照,避免并发读预检抢占 SQLite 写锁。 + using var tx = conn.BeginTransaction(deferred: true); return action(new SqliteTx(conn)); }