WP-02: contracts and failing tests for settings, mail, jobs and scheduler
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
30
backend/crates/application/src/scheduler.rs
Normal file
30
backend/crates/application/src/scheduler.rs
Normal file
@ -0,0 +1,30 @@
|
||||
//! Cron scheduler: decides which scheduled job kinds are due.
|
||||
use chrono::{DateTime, Utc};
|
||||
use domain::jobs::JobKind;
|
||||
use domain::DomainError;
|
||||
|
||||
/// Validate a 6-field cron expression (seconds first).
|
||||
pub fn validate_cron(_expr: &str) -> Result<(), DomainError> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// Next fire time strictly after `after`.
|
||||
pub fn next_fire(_expr: &str, _after: DateTime<Utc>) -> Option<DateTime<Utc>> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
/// A job is due if a fire time exists in `(last_run, now]`. With no last run, it is due
|
||||
/// if a fire time falls within the last `grace` seconds, so a fresh start does not
|
||||
/// immediately run every job.
|
||||
pub fn is_due(
|
||||
_expr: &str,
|
||||
_last_run: Option<DateTime<Utc>>,
|
||||
_now: DateTime<Utc>,
|
||||
_grace_secs: i64,
|
||||
) -> bool {
|
||||
todo!()
|
||||
}
|
||||
|
||||
pub struct Scheduler {
|
||||
pub kinds: Vec<JobKind>,
|
||||
}
|
||||
Reference in New Issue
Block a user