Skip to content

fix(raft): fix election and network issues in raft event loop#127

Merged
slow2342 merged 3 commits into
mainfrom
fix/raft-formatting
Jun 14, 2026
Merged

fix(raft): fix election and network issues in raft event loop#127
slow2342 merged 3 commits into
mainfrom
fix/raft-formatting

Conversation

@slow2342

Copy link
Copy Markdown
Owner

Summary

  • Replace spin-based ticking with Instant-based accurate timing to prevent tick drift
  • Reorder ready processing to send leader messages before persisting entries (raft-rs best practice)
  • Fix heartbeat interval from 100ms to 200ms and set max_committed_size_per_ready
  • Add tracing for raft messages, proposals, and leader state transitions
  • Improve network sender error handling to distinguish RPC errors from task panics
  • Fix long line formatting in tracing macros

Changes

  • src/raft/node.rs — Rewrite tick logic using Instant for accurate timing, reorder ready processing steps, add structured tracing, fix formatting
  • src/raft/network.rs — Improve error handling in network sender
  • src/raft/rpc.rs — Add tracing for incoming RPCs
  • src/raft/raftrs_store.rs — Minor fix
  • src/main.rs — Minor adjustment

How to verify

cargo build
cargo test --all-targets
cargo clippy --all-targets -- -D warnings

slow2342 added 3 commits June 14, 2026 18:29
Replace spin-based ticking with Instant-based accurate timing to prevent
tick drift. Reorder ready processing to send leader messages before
persisting entries, matching raft-rs best practices. Fix heartbeat interval
from 100ms to 200ms and set max_committed_size_per_ready to ensure entries
are returned from ready(). Add tracing for raft messages, proposals, and
leader state transitions to aid debugging. Improve network sender error
handling to distinguish between RPC errors and task panics.
Wrap tracing macro arguments that exceeded line length limits.
@slow2342 slow2342 merged commit bbb4338 into main Jun 14, 2026
3 checks passed
@slow2342 slow2342 deleted the fix/raft-formatting branch June 14, 2026 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant