Skip to content

Commit

Permalink
rework comments
Browse files Browse the repository at this point in the history
  • Loading branch information
m-lord-renkse committed Jan 3, 2025
1 parent 8432985 commit 0f65cf7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 4 additions & 2 deletions crates/autopilot/src/infra/solvers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ pub struct Driver {
pub enum Error {
#[error("unable to load KMS account")]
UnableToLoadKmsAccount,
#[error("failed to build client")]
FailedToBuildClient(#[source] reqwest::Error),
}

impl Driver {
pub async fn new(
pub async fn try_new(
url: Url,
name: String,
fairness_threshold: Option<eth::Ether>,
Expand Down Expand Up @@ -59,7 +61,7 @@ impl Driver {
client: Client::builder()
.timeout(RESPONSE_TIME_LIMIT)
.build()
.unwrap(),
.map_err(Error::FailedToBuildClient)?,
submission_address: submission_address.into(),
})
}
Expand Down
10 changes: 4 additions & 6 deletions crates/autopilot/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -552,22 +552,21 @@ pub async fn run(args: Arguments) {
.drivers
.into_iter()
.map(|driver| async move {
infra::Driver::new(
infra::Driver::try_new(
driver.url,
driver.name.clone(),
driver.fairness_threshold.map(Into::into),
driver.submission_account,
)
.await
.ok()
.map(Arc::new)
.expect("failed to load solver configuration")
})
.collect::<Vec<_>>();

let drivers = futures::future::join_all(drivers_futures)
.await
.into_iter()
.flatten()
.collect();

let run = RunLoop::new(
Expand Down Expand Up @@ -595,22 +594,21 @@ async fn shadow_mode(args: Arguments) -> ! {
.drivers
.into_iter()
.map(|driver| async move {
infra::Driver::new(
infra::Driver::try_new(
driver.url,
driver.name.clone(),
driver.fairness_threshold.map(Into::into),
driver.submission_account,
)
.await
.ok()
.map(Arc::new)
.expect("failed to load solver configuration")
})
.collect::<Vec<_>>();

let drivers = futures::future::join_all(drivers_futures)
.await
.into_iter()
.flatten()
.collect();

let trusted_tokens = {
Expand Down

0 comments on commit 0f65cf7

Please sign in to comment.