Ensure catch!()
and run!()
macros are consistent (#4700)
This commit is contained in:
parent
dc06603d5b
commit
a94d356017
2 changed files with 4 additions and 4 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue