Skip to content

Commit

Permalink
improve nesting
Browse files Browse the repository at this point in the history
  • Loading branch information
relaxolotl committed Jul 12, 2021
1 parent ea6a386 commit 639a4cd
Showing 1 changed file with 17 additions and 27 deletions.
44 changes: 17 additions & 27 deletions crates/symbolicator/src/services/download/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,36 +99,26 @@ impl DownloadService {
source: RemoteDif,
destination: PathBuf,
) -> Result<DownloadStatus, DownloadError> {
let result = match &source {
RemoteDif::Sentry(inner) => {
future_utils::retry(|| {
let result = future_utils::retry(|| async {
let destination = destination.clone();
match &source {
RemoteDif::Sentry(inner) => {
self.sentry
.download_source(inner.clone(), destination.clone())
})
.await
}
RemoteDif::Http(inner) => {
future_utils::retry(|| {
self.http
.download_source(inner.clone(), destination.clone())
})
.await
}
RemoteDif::S3(inner) => {
future_utils::retry(|| self.s3.download_source(inner.clone(), destination.clone()))
.await
}
RemoteDif::Gcs(inner) => {
future_utils::retry(|| self.gcs.download_source(inner.clone(), destination.clone()))
.await
}
RemoteDif::Filesystem(inner) => {
future_utils::retry(|| self.fs.download_source(inner.clone(), destination.clone()))
.await
.download_source(inner.clone(), destination)
.await
}
RemoteDif::Http(inner) => {
self.http.download_source(inner.clone(), destination).await
}
RemoteDif::S3(inner) => self.s3.download_source(inner.clone(), destination).await,
RemoteDif::Gcs(inner) => self.gcs.download_source(inner.clone(), destination).await,
RemoteDif::Filesystem(inner) => {
self.fs.download_source(inner.clone(), destination).await
}
}
};
});

match result {
match result.await {
Ok(DownloadStatus::NotFound) => {
log::debug!(
"Did not fetch debug file from {:?}: {:?}",
Expand Down

0 comments on commit 639a4cd

Please sign in to comment.