Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Commit

Permalink
Log errors in Faucet healthcheck.
Browse files Browse the repository at this point in the history
  • Loading branch information
philippecamacho committed Jun 30, 2022
1 parent 261f6f8 commit 5b62743
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions faucet/src/faucet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,23 @@ async fn healthcheck(req: tide::Request<FaucetState>) -> Result<tide::Response,
// Ensure we can write to storage.
let mut index = req.state().queue.index.lock().await;
let default_user_pub_key = UserPubKey::default();
index.insert(default_user_pub_key.clone())?;
index.remove(&default_user_pub_key)?;
let res = index.insert(default_user_pub_key.clone());
if res.is_err() {
tracing::error!(
"Insertion of dummy public key into faucet queue index failed. {:?}",
res
);
return Err(faucet_server_error(res.err().unwrap()));
}

let res = index.remove(&default_user_pub_key);
if res.is_err() {
tracing::error!(
"Removal of dummy public key from faucet queue index failed. {:?}",
res
);
return Err(faucet_server_error(res.err().unwrap()));
}

// Return healthcheck response
response(
Expand Down

0 comments on commit 5b62743

Please sign in to comment.