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

Fix sleep condition #187

Merged
merged 1 commit into from
Jun 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading