Skip to content

Commit

Permalink
azure: use tokio::time::timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
koivunej committed Feb 13, 2024
1 parent 6181d7f commit 0619578
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions libs/remote_storage/src/azure_blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,21 +408,19 @@ impl RemoteStorage for AzureBlobStorage {

let request = blob_client.delete().into_future();

let res = tokio::select! {
res = request => res,
_ = tokio::time::sleep(self.timeout) => return Err(TimeoutOrCancel::Timeout.into()),
};
let res = tokio::time::timeout(self.timeout, request).await;

match res {
Ok(_response) => continue,
Err(e) => {
Ok(Ok(_response)) => continue,
Ok(Err(e)) => {
if let Some(http_err) = e.as_http_error() {
if http_err.status() == StatusCode::NotFound {
continue;
}
}
return Err(e.into());
}
Err(_elapsed) => return Err(TimeoutOrCancel::Timeout.into()),
}
}

Expand Down

0 comments on commit 0619578

Please sign in to comment.