Ensure we use the correct transaction type (optimistic/pessimistic)

Closes #79
This commit is contained in:
Tobie Morgan Hitchcock 2022-08-30 22:34:55 +01:00
parent 738ba5d0e5
commit 58591f82dc

View file

@ -33,7 +33,7 @@ impl Datastore {
// Start a new transaction
pub async fn transaction(&self, write: bool, lock: bool) -> Result<Transaction, Error> {
match lock {
true => {
false => {
// Set the behaviour when dropping an unfinished transaction
let opt = TransactionOptions::new_optimistic().drop_check(CheckLevel::Warn);
// Create a new optimistic transaction
@ -46,7 +46,7 @@ impl Datastore {
Err(e) => Err(Error::Tx(e.to_string())),
}
}
false => {
true => {
// Set the behaviour when dropping an unfinished transaction
let opt = TransactionOptions::new_pessimistic().drop_check(CheckLevel::Warn);
// Create a new pessimistic transaction