perf(store-and-forward): enable WAL + per-connection busy_timeout on the S&F SQLite store
This commit is contained in:
@@ -656,4 +656,31 @@ public class StoreAndForwardStorageTests : IAsyncLifetime, IDisposable
|
||||
Directory.Delete(directory, recursive: true);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Initialize_EnablesWalJournalMode_OnFileDatabase()
|
||||
{
|
||||
// WAL lets the retry-sweep lanes, script enqueues, and standby replication
|
||||
// applies read/write concurrently without "database is locked". journal_mode
|
||||
// is persistent + file-scoped, so a fresh connection observes it.
|
||||
var directory = Path.Combine(Path.GetTempPath(), "sf-wal-test-" + Guid.NewGuid().ToString("N"));
|
||||
var path = Path.Combine(directory, "wal-test.db");
|
||||
try
|
||||
{
|
||||
var storage = new StoreAndForwardStorage(
|
||||
$"Data Source={path}", NullLogger<StoreAndForwardStorage>.Instance);
|
||||
await storage.InitializeAsync();
|
||||
|
||||
await using var conn = new SqliteConnection($"Data Source={path}");
|
||||
await conn.OpenAsync();
|
||||
await using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = "PRAGMA journal_mode";
|
||||
Assert.Equal("wal", (string)(await cmd.ExecuteScalarAsync())!);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (Directory.Exists(directory))
|
||||
Directory.Delete(directory, recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user