mirror of
https://github.com/GothenburgBitFactory/taskchampion-sync-server.git
synced 2026-04-06 09:40:43 +00:00
Support sequential consistency in SQLite implementation (#64)
This is a bit tricky because the `Storage` trait is `Send + Sync`, but an SQLite connection is neither. Since this is not intended for large-scale use, the simple solution is just to open a new SQLite connection for each transaction. More complex alternatives include thread-local connection pools or a "worker thread" that owns the connection and communicates with other threads via channels. This also updates the InMemoryStorage implementation to be a bit more strict about transactional integrity, which led to a number of test changes.
This commit is contained in:
committed by
GitHub
parent
75f384d4ec
commit
4029c03479
@ -307,7 +307,12 @@ mod test {
|
||||
{
|
||||
let _ = env_logger::builder().is_test(true).try_init();
|
||||
let storage = InMemoryStorage::new();
|
||||
let res = init(storage.txn()?.as_mut())?;
|
||||
let res;
|
||||
{
|
||||
let mut txn = storage.txn()?;
|
||||
res = init(txn.as_mut())?;
|
||||
txn.commit()?;
|
||||
}
|
||||
Ok((Server::new(ServerConfig::default(), storage), res))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user