Skip to content

Commit

Permalink
Added docs and fixed function declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
DenuxPlays committed Jan 15, 2025
1 parent 3328f54 commit f63574d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub async fn run_scheduler<H: Hooks>(
println!("{scheduler}");
Ok(())
} else {
scheduler.run_on_start().await?;
scheduler.run_on_start();

Ok(scheduler.run().await?)
}
Expand Down
8 changes: 3 additions & 5 deletions src/scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ impl Scheduler {
Ok(())
}

pub async fn run_on_start(&self) -> Result<()> {
/// Runs every task that is configured to run at start without scheduling them.
pub fn run_on_start(&self) {
for job_name in &self.run_on_start {
if let Some(job) = self.jobs.get(job_name) {
let job_description =
Expand All @@ -376,8 +377,6 @@ impl Scheduler {
tracing::warn!("Job not found in run_on_start: {}", job_name);
}
}

Ok(())
}
}

Expand Down Expand Up @@ -588,9 +587,8 @@ mod tests {
environment,
};

let result = scheduler.run_on_start().await;
scheduler.run_on_start();

assert!(result.is_ok());
assert!(
std::fs::read_to_string(tree_fs.root.join("scheduler.txt"))
.unwrap()
Expand Down

0 comments on commit f63574d

Please sign in to comment.