Skip to content

Commit

Permalink
fix: set MissedTickBehavior::Delay
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyXu committed Jul 12, 2024
1 parent 640e462 commit 941ef2d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/meta-srv/src/election/etcd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use snafu::{ensure, OptionExt, ResultExt};
use tokio::sync::broadcast;
use tokio::sync::broadcast::error::RecvError;
use tokio::sync::broadcast::Receiver;
use tokio::time::timeout;
use tokio::time::{timeout, MissedTickBehavior};

use crate::election::{Election, LeaderChangeMessage, CANDIDATES_ROOT, ELECTION_KEY};
use crate::error;
Expand Down Expand Up @@ -234,6 +234,7 @@ impl Election for EtcdElection {

let mut keep_alive_interval =
tokio::time::interval(Duration::from_secs(META_KEEP_ALIVE_INTERVAL_SECS));
keep_alive_interval.set_missed_tick_behavior(MissedTickBehavior::Delay);
loop {
// The keep alive operation MUST be done in `META_KEEP_ALIVE_INTERVAL_SECS`.
match timeout(
Expand Down

0 comments on commit 941ef2d

Please sign in to comment.