Ensure catch!() and run!() macros are consistent (#4700)

This commit is contained in:
Tobie Morgan Hitchcock 2024-09-05 10:26:46 +01:00 committed by GitHub
parent dc06603d5b
commit a94d356017
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View file

@ -27,7 +27,7 @@ impl Datastore {
let key = crate::key::root::nd::Nd::new(id);
let now = self.clock_now().await;
let val = Node::new(id, now, false);
match run!(txn, txn.put(key, val, None)) {
match run!(txn, txn.put(key, val, None).await) {
Err(Error::TxKeyAlreadyExists) => Err(Error::ClAlreadyExists {
value: id.to_string(),
}),
@ -51,7 +51,7 @@ impl Datastore {
let key = crate::key::root::nd::new(id);
let now = self.clock_now().await;
let val = Node::new(id, now, false);
run!(txn, txn.set(key, val, None))
run!(txn, txn.set(key, val, None).await)
}
/// Deletes a node from the cluster.
@ -70,7 +70,7 @@ impl Datastore {
let key = crate::key::root::nd::new(id);
let val = txn.get_node(id).await?;
let val = val.as_ref().archive();
run!(txn, txn.set(key, val, None))
run!(txn, txn.set(key, val, None).await)
}
/// Expires nodes which have timedout from the cluster.

View file

@ -55,7 +55,7 @@ macro_rules! catch {
/// transaction in an uncommitted state without rolling back.
macro_rules! run {
($txn:ident, $default:expr) => {
match $default.await {
match $default {
Err(e) => {
let _ = $txn.cancel().await;
Err(e)