@@ -88,9 +88,9 @@ use crate::storage::LogFlushed;
8888use crate :: storage:: RaftLogReaderExt ;
8989use crate :: storage:: RaftLogStorage ;
9090use crate :: storage:: RaftStateMachine ;
91- use crate :: type_config:: alias:: AsyncRuntimeOf ;
9291use crate :: type_config:: alias:: InstantOf ;
9392use crate :: type_config:: alias:: ResponderOf ;
93+ use crate :: type_config:: TypeConfigExt ;
9494use crate :: AsyncRuntime ;
9595use crate :: ChangeMembers ;
9696use crate :: Instant ;
@@ -148,7 +148,7 @@ pub(crate) struct LeaderData<C: RaftTypeConfig> {
148148impl < C : RaftTypeConfig > LeaderData < C > {
149149 pub ( crate ) fn new ( ) -> Self {
150150 Self {
151- next_heartbeat : InstantOf :: < C > :: now ( ) ,
151+ next_heartbeat : C :: now ( ) ,
152152 }
153153 }
154154}
@@ -509,19 +509,12 @@ where
509509 /// Currently heartbeat is a blank log
510510 #[ tracing:: instrument( level = "debug" , skip_all, fields( id = display( self . id) ) ) ]
511511 pub fn send_heartbeat ( & mut self , emitter : impl Display ) -> bool {
512- tracing:: debug!(
513- now = debug( <C :: AsyncRuntime as AsyncRuntime >:: Instant :: now( ) ) ,
514- "send_heartbeat"
515- ) ;
512+ tracing:: debug!( now = debug( C :: now( ) ) , "send_heartbeat" ) ;
516513
517514 let mut lh = if let Some ( ( lh, _) ) = self . engine . get_leader_handler_or_reject ( None ) {
518515 lh
519516 } else {
520- tracing:: debug!(
521- now = debug( <C :: AsyncRuntime as AsyncRuntime >:: Instant :: now( ) ) ,
522- "{} failed to send heartbeat" ,
523- emitter
524- ) ;
517+ tracing:: debug!( now = debug( C :: now( ) ) , "{} failed to send heartbeat" , emitter) ;
525518 return false ;
526519 } ;
527520
@@ -1150,7 +1143,7 @@ where
11501143 self . handle_append_entries_request ( rpc, tx) ;
11511144 }
11521145 RaftMsg :: RequestVote { rpc, tx } => {
1153- let now = < C :: AsyncRuntime as AsyncRuntime > :: Instant :: now ( ) ;
1146+ let now = C :: now ( ) ;
11541147 tracing:: info!(
11551148 now = display( now. display( ) ) ,
11561149 vote_request = display( & rpc) ,
@@ -1237,7 +1230,7 @@ where
12371230 resp,
12381231 sender_vote,
12391232 } => {
1240- let now = < C :: AsyncRuntime as AsyncRuntime > :: Instant :: now ( ) ;
1233+ let now = C :: now ( ) ;
12411234
12421235 tracing:: info!(
12431236 now = display( now. display( ) ) ,
@@ -1273,7 +1266,7 @@ where
12731266 Notify :: Tick { i } => {
12741267 // check every timer
12751268
1276- let now = < C :: AsyncRuntime as AsyncRuntime > :: Instant :: now ( ) ;
1269+ let now = C :: now ( ) ;
12771270 tracing:: debug!( "received tick: {}, now: {:?}" , i, now) ;
12781271
12791272 self . handle_tick_election ( ) ;
@@ -1291,8 +1284,7 @@ where
12911284
12921285 // Install next heartbeat
12931286 if let Some ( l) = & mut self . leader_data {
1294- l. next_heartbeat = <C :: AsyncRuntime as AsyncRuntime >:: Instant :: now ( )
1295- + Duration :: from_millis ( self . config . heartbeat_interval ) ;
1287+ l. next_heartbeat = C :: now ( ) + Duration :: from_millis ( self . config . heartbeat_interval ) ;
12961288 }
12971289 }
12981290 }
@@ -1431,7 +1423,7 @@ where
14311423
14321424 #[ tracing:: instrument( level = "debug" , skip_all) ]
14331425 fn handle_tick_election ( & mut self ) {
1434- let now = < C :: AsyncRuntime as AsyncRuntime > :: Instant :: now ( ) ;
1426+ let now = C :: now ( ) ;
14351427
14361428 tracing:: debug!( "try to trigger election by tick, now: {:?}" , now) ;
14371429
@@ -1660,7 +1652,7 @@ where
16601652
16611653 // False positive lint warning(`non-binding `let` on a future`): https://github.com/rust-lang/rust-clippy/issues/9932
16621654 #[ allow( clippy:: let_underscore_future) ]
1663- let _ = AsyncRuntimeOf :: < C > :: spawn ( async move {
1655+ let _ = C :: spawn ( async move {
16641656 for ( log_index, tx) in removed. into_iter ( ) {
16651657 tx. send ( Err ( ClientWriteError :: ForwardToLeader ( ForwardToLeader {
16661658 leader_id,
0 commit comments