Ensure we use the correct transaction type (optimistic/pessimistic)
Closes #79
This commit is contained in:
parent
738ba5d0e5
commit
58591f82dc
1 changed files with 2 additions and 2 deletions
|
@ -33,7 +33,7 @@ impl Datastore {
|
||||||
// Start a new transaction
|
// Start a new transaction
|
||||||
pub async fn transaction(&self, write: bool, lock: bool) -> Result<Transaction, Error> {
|
pub async fn transaction(&self, write: bool, lock: bool) -> Result<Transaction, Error> {
|
||||||
match lock {
|
match lock {
|
||||||
true => {
|
false => {
|
||||||
// Set the behaviour when dropping an unfinished transaction
|
// Set the behaviour when dropping an unfinished transaction
|
||||||
let opt = TransactionOptions::new_optimistic().drop_check(CheckLevel::Warn);
|
let opt = TransactionOptions::new_optimistic().drop_check(CheckLevel::Warn);
|
||||||
// Create a new optimistic transaction
|
// Create a new optimistic transaction
|
||||||
|
@ -46,7 +46,7 @@ impl Datastore {
|
||||||
Err(e) => Err(Error::Tx(e.to_string())),
|
Err(e) => Err(Error::Tx(e.to_string())),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false => {
|
true => {
|
||||||
// Set the behaviour when dropping an unfinished transaction
|
// Set the behaviour when dropping an unfinished transaction
|
||||||
let opt = TransactionOptions::new_pessimistic().drop_check(CheckLevel::Warn);
|
let opt = TransactionOptions::new_pessimistic().drop_check(CheckLevel::Warn);
|
||||||
// Create a new pessimistic transaction
|
// Create a new pessimistic transaction
|
||||||
|
|
Loading…
Reference in a new issue