Enable write-ahead log for SQLite connections to prevent blocking concurrent writes and reads

This commit is contained in:
chylex 2022-03-21 00:36:29 +01:00
parent 3e891e19c3
commit 9ca56bd910
No known key found for this signature in database
GPG Key ID: 4DE42C8F19A80548

View File

@ -24,7 +24,14 @@ namespace DHT.Server.Database.Sqlite.Utils {
for (int i = 0; i < poolSize; i++) {
var conn = new SqliteConnection(connectionString);
conn.Open();
free.Add(new PooledConnection(this, conn));
var pooledConn = new PooledConnection(this, conn);
using (var cmd = pooledConn.Command("PRAGMA journal_mode=WAL")) {
cmd.ExecuteNonQuery();
}
free.Add(pooledConn);
}
used = new List<PooledConnection>(poolSize);