Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Optimize] Skip the scheduled batch proposal if already proposing #3112

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions node/bft/src/primary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,12 @@ impl<N: Network> Primary<N> {
debug!("Skipping batch proposal {}", "(node is syncing)".dimmed());
continue;
}
// A best-effort attempt to skip the scheduled batch proposal if
// round progression already triggered one.
if self_.propose_lock.try_lock().is_err() {
trace!("Skipping batch proposal {}", "(node is already proposing)".dimmed());
continue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add some debug! message here for observing that there's an ongoing batch proposal attempt?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could be useful, but if my intuition is correct, such an occurrence could just be ignored (so a log would only increase verbosity); either way works for me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved in 44f498b

howardwu marked this conversation as resolved.
Show resolved Hide resolved
};
// If there is no proposed batch, attempt to propose a batch.
// Note: Do NOT spawn a task around this function call. Proposing a batch is a critical path,
// and only one batch needs be proposed at a time.
Expand Down