1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! A high-performance async cron scheduler.
//!
//! # Example
//!
//! ```
//! use cronscheduler::{SchedulerActor, WorkerActor, HttpTask, SimpleLoggingTask, CommandLineTask, ExecutionPolicy, SchedulingPolicy};
//! use std::sync::Arc;
//! use tokio::sync::mpsc;
//! use reqwest::Client;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
//! let (worker_tx, worker_rx) = mpsc::channel(100);
//! let worker = WorkerActor::new(worker_rx);
//! tokio::spawn(async move { worker.run().await; });
//!
//! let mut scheduler = SchedulerActor::new(worker_tx);
//!
//! // Async task
//! let log_task = Arc::new(SimpleLoggingTask { id: "heartbeat".to_string() });
//! scheduler.add_task(log_task, "*/5 * * * * *", ExecutionPolicy::Parallel, SchedulingPolicy::FirstInFirstOut, 0)?;
//!
//! // Blocking task
//! let ping_task = Arc::new(CommandLineTask {
//! id: "ping-google".to_string(),
//! command: "ping".to_string(),
//! args: vec!["-c".to_string(), "1".to_string(), "8.8.8.8".to_string()],
//! });
//! scheduler.add_task(ping_task, "*/30 * * * * *", ExecutionPolicy::SkipIfRunning, SchedulingPolicy::FirstInFirstOut, 0)?;
//!
//! Ok(())
//! }
//! ```
pub use SchedulerActor;
pub use WorkerActor;
pub use CronParser;
pub use ;
pub use ;
/// A high performance async cron scheduler runner.
///
/// This is a convenience function to demonstrate library usage.