feat: allow job to start immediately
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
parent
08145eed13
commit
55498adffd
@ -34,6 +34,21 @@ where
|
|||||||
|
|
||||||
async move {
|
async move {
|
||||||
let mut wait = interval;
|
let mut wait = interval;
|
||||||
|
let start = std::time::Instant::now();
|
||||||
|
|
||||||
|
tracing::debug!("running job");
|
||||||
|
if let Err(e) = drifter.execute(child_token).await {
|
||||||
|
tracing::error!("drift job failed with error: {}, stopping routine", e);
|
||||||
|
cancellation_token.cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
let elapsed = start.elapsed();
|
||||||
|
wait = interval.saturating_sub(elapsed);
|
||||||
|
tracing::debug!(
|
||||||
|
"job took: {}ms, waiting: {}ms for next run",
|
||||||
|
elapsed.as_millis(),
|
||||||
|
wait.as_millis()
|
||||||
|
);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let child_token = cancellation_token.child_token();
|
let child_token = cancellation_token.child_token();
|
||||||
|
Loading…
Reference in New Issue
Block a user