gaffer 0.2.0

Prioritised, parallel job scheduler with concurrent exclusion, job merging, recurring jobs and load limiting for lower priorities.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Example of executing jobs in parallel
//!
//! Schedules some jobs which wait for 1 second across 10 threads
fn main() -> Result<(), Box<dyn std::error::Error>> {
    let runner = gaffer::JobRunner::builder().build(10);

    for i in 1..=50 {
        let name = format!("WaitJob {}", i);
        runner.send(move || {
            std::thread::sleep(std::time::Duration::from_secs(1));
            println!("Completed job {:?}", name);
        })?;
    }

    println!("Jobs enqueued");
    std::thread::sleep(std::time::Duration::from_secs(7));
    Ok(())
}