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

Commit

Permalink
fix sleep condition
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-maron committed Jun 27, 2024
1 parent 726db5e commit 03360a3
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/builder_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -517,12 +517,15 @@ impl<TYPES: NodeType> BuilderProgress<TYPES> for BuilderState<TYPES> {
let sleep_interval = self.maximize_txn_capture_timeout / 10;
while Instant::now() <= timeout_after {
self.collect_txns(timeout_after).await;
if Instant::now() + sleep_interval <= timeout_after {

if !self.tx_queue.is_empty() // we have transactions
|| Instant::now() + sleep_interval > timeout_after
// we don't have time for another iteration
{
break;
}
if self.tx_queue.is_empty() {
async_sleep(sleep_interval).await;
}

async_sleep(sleep_interval).await
}
if let Ok((payload, metadata)) =
<TYPES::BlockPayload as BlockPayload<TYPES>>::from_transactions(
Expand Down

0 comments on commit 03360a3

Please sign in to comment.