Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
Signed-off-by: remzi <[email protected]>
  • Loading branch information
HaoYang670 committed Jan 15, 2025
1 parent d38b151 commit 3f727f2
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions rucat_state_monitor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,7 @@ where
&id,
&old_state,
&new_state,
get_next_update_time(
&new_state,
SystemTime::now(),
self.check_interval,
self.trigger_state_timeout,
),
self.get_next_update_time(&new_state),
)
.await;
}
Expand Down Expand Up @@ -181,12 +176,7 @@ where
}
_ => unreachable!("Should not release engine in state {:?}", current_state),
};
let next_update_time = get_next_update_time(
&new_state,
SystemTime::now(),
self.check_interval,
self.trigger_state_timeout,
);
let next_update_time = self.get_next_update_time(&new_state);
let response = self
.db_client
.update_engine_state(id, current_state, &new_state, next_update_time)
Expand Down Expand Up @@ -235,12 +225,7 @@ where
ErrorWaitToClean(s) => ErrorTriggerClean(s.clone()),
_ => unreachable!("Should not acquire engine in state {:?}", current_state),
};
let next_update_time = get_next_update_time(
&new_state,
SystemTime::now(),
self.check_interval,
self.trigger_state_timeout,
);
let next_update_time = self.get_next_update_time(&new_state);
self.inspect_engine_state_updating(id, current_state, &new_state, next_update_time)
.await
}
Expand Down Expand Up @@ -289,6 +274,15 @@ where
}
}
}

fn get_next_update_time(&self, state: &EngineState) -> Option<SystemTime> {
get_next_update_time(
state,
SystemTime::now(),
self.check_interval,
self.trigger_state_timeout,
)
}
}

/// Get the next update time of the engine.
Expand Down

0 comments on commit 3f727f2

Please sign in to comment.