Bugfix - ret. QueryNotExecuted if implicit txn. fails to commit. (#2039)
This commit is contained in:
parent
e962eae70c
commit
5e0e72def2
2 changed files with 12 additions and 4 deletions
lib/src
|
@ -296,14 +296,22 @@ impl<'a> Executor<'a> {
|
|||
// There is no timeout clause
|
||||
None => stm.compute(&ctx, &opt, &self.txn(), None).await,
|
||||
};
|
||||
// Finalise transaction
|
||||
// Finalise transaction and return the result.
|
||||
if res.is_ok() && stm.writeable() {
|
||||
self.commit(loc).await;
|
||||
if self.err {
|
||||
// The commit failed
|
||||
Err(Error::QueryNotExecuted)
|
||||
} else {
|
||||
// Successful, committed result
|
||||
res
|
||||
}
|
||||
} else {
|
||||
self.cancel(loc).await;
|
||||
|
||||
// An error
|
||||
res
|
||||
}
|
||||
// Return the result
|
||||
res
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ impl Transaction {
|
|||
}
|
||||
// Mark this transaction as done
|
||||
self.ok = true;
|
||||
// Cancel this transaction
|
||||
// Commit this transaction
|
||||
self.tx.commit().await?;
|
||||
// Continue
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in a new issue