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

Commit

Permalink
Merge pull request #243 from EspressoSystems/keyao/fix-lock
Browse files Browse the repository at this point in the history
Fix potential sleep with lock
  • Loading branch information
shenkeyao authored Aug 20, 2024
2 parents f358101 + 40a2cc0 commit adf440c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ where
let time_to_wait_for_matching_builder = starting_time + self.max_api_waiting_time / 2;

let mut sent = false;
while !sent && Instant::now() < time_to_wait_for_matching_builder {
while Instant::now() < time_to_wait_for_matching_builder {
// try to broadcast the request to the correct builder state
if let Some(builder) = self
.global_state
Expand All @@ -431,12 +431,11 @@ where
tracing::warn!("Error {e} sending get_available_blocks request for {state_id}",);
}
sent = true;
} else {
tracing::info!(
"Failed to get matching BlockBuilder for {state_id}, will try again",
);
async_sleep(check_duration).await
break;
}

tracing::info!("Failed to get matching BlockBuilder for {state_id}, will try again",);
async_sleep(check_duration).await;
}

if !sent {
Expand Down

0 comments on commit adf440c

Please sign in to comment.