From 58591f82dcaf3f55ba7b3a9a7ff3177ebea20124 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 30 Aug 2022 22:34:55 +0100 Subject: [PATCH] Ensure we use the correct transaction type (optimistic/pessimistic) Closes #79 --- lib/src/kvs/tikv/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/kvs/tikv/mod.rs b/lib/src/kvs/tikv/mod.rs index 6afa8387..7ea9a6da 100644 --- a/lib/src/kvs/tikv/mod.rs +++ b/lib/src/kvs/tikv/mod.rs @@ -33,7 +33,7 @@ impl Datastore { // Start a new transaction pub async fn transaction(&self, write: bool, lock: bool) -> Result { 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