I'm using SQLite (System.Data.SQLite.dll) in a multi-threaded Windows desktop program. I use this code:
using (var cn = new SQLiteConnection(connectionString))
{
cn.Open();
using (var tx = cn.BeginTransaction())
{
// do some work here
tx.Commit();
}
}
I'm stressing the program using 8 concurrent threads writing to the database at the same time. Sometimes I see this message on the output window:
SQLite error (517): statement aborts at 1: [BEGIN IMMEDIATE] database is locked
But no exception is thrown at all, and everything works as expected. So I'm guessing SQLConnection.BeginTrasaction() retries when it receives SQLite error (517) database is locked.
Am I right?
If yes, how many times SQLConnection.BeginTransaction retries before throwing an exception. Is this configurable?
Aucun commentaire:
Enregistrer un commentaire