Skip to content

Commit

Permalink
bit more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco committed Jul 3, 2024
1 parent 17b8e76 commit f34b2e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
6 changes: 2 additions & 4 deletions nexus/src/app/background/tasks/region_replacement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use crate::app::sagas::NexusSaga;
use crate::app::RegionAllocationStrategy;
use futures::future::BoxFuture;
use futures::FutureExt;
use futures::TryFutureExt;
use nexus_db_model::RegionReplacement;
use nexus_db_queries::context::OpContext;
use nexus_db_queries::db::DataStore;
Expand Down Expand Up @@ -50,9 +49,8 @@ impl RegionReplacementDetector {
RegionAllocationStrategy::RandomWithDistinctSleds { seed: None },
};

futures::future::ready(SagaRegionReplacementStart::prepare(&params))
.and_then(|saga_dag| self.sagas.saga_start(saga_dag))
.await
let saga_dag = SagaRegionReplacementStart::prepare(&params)?;
self.sagas.saga_start(saga_dag).await
}
}

Expand Down
18 changes: 9 additions & 9 deletions nexus/src/app/background/tasks/region_replacement_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ use crate::app::sagas::region_replacement_finish::SagaRegionReplacementFinish;
use crate::app::sagas::NexusSaga;
use futures::future::BoxFuture;
use futures::FutureExt;
use futures::TryFutureExt;
use nexus_db_queries::context::OpContext;
use nexus_db_queries::db::DataStore;
use nexus_types::internal_api::background::RegionReplacementDriverStatus;
Expand Down Expand Up @@ -124,10 +123,11 @@ impl RegionReplacementDriver {
serialized_authn: authn::saga::Serialized::for_opctx(opctx),
request,
};
let result = futures::future::ready(
SagaRegionReplacementDrive::prepare(&params),
)
.and_then(|saga_dag| self.sagas.saga_start(saga_dag))
let result = async {
let saga_dag =
SagaRegionReplacementDrive::prepare(&params)?;
self.sagas.saga_start(saga_dag).await
}
.await;
match result {
Ok(_) => {
Expand Down Expand Up @@ -194,10 +194,10 @@ impl RegionReplacementDriver {
region_volume_id: old_region_volume_id,
request,
};
let result = futures::future::ready(
SagaRegionReplacementFinish::prepare(&params),
)
.and_then(|saga_dag| self.sagas.saga_start(saga_dag))
let result = async {
let saga_dag = SagaRegionReplacementFinish::prepare(&params)?;
self.sagas.saga_start(saga_dag).await
}
.await;
match result {
Ok(_) => {
Expand Down

0 comments on commit f34b2e3

Please sign in to comment.