Skip to content

Commit

Permalink
Fix: Monoio yield when running the main loop due to an issue with the…
Browse files Browse the repository at this point in the history
… runtime

Signed-off-by: Anthony Griffon <[email protected]>
  • Loading branch information
Miaxos committed Feb 22, 2024
1 parent 0a47af0 commit ab51c74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 5 additions & 0 deletions openraft/src/core/raft_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,11 @@ where
let raft_msg_processed = self.process_raft_msg(balancer.raft_msg()).await?;
let notify_processed = self.process_notify(balancer.notify()).await?;

// HACK: To force a yield when using monoio, it seems if we are not doing this we got
// an issue
#[cfg(feature = "monoio")]
monoio::time::sleep(Duration::from_millis(0)).await;

// If one of the channel consumed all its budget, re-balance the budget ratio.

#[allow(clippy::collapsible_else_if)]
Expand Down
1 change: 0 additions & 1 deletion tests/tests/membership/t11_add_learner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,6 @@ async fn add_learner_with_set_nodes() -> Result<()> {
/// Because adding learner is also a change-membership operation, a new membership config log will
/// let raft consider the previous membership config log as committed, which is actually not.
#[async_entry::test(worker_threads = 8, init = "init_default_ut_tracing()", tracing_span = "debug")]
#[cfg_attr(feature = "monoio", ignore)] // Crashing the future is causing a whole crash with monoio
async fn add_learner_when_previous_membership_not_committed() -> Result<()> {
let config = Arc::new(
Config {
Expand Down

0 comments on commit ab51c74

Please sign in to comment.