Skip to content

Commit

Permalink
feat(scheduler): Add simple tokio-cron-scheduler job (#21)
Browse files Browse the repository at this point in the history
Just an example of what our celery-beat style task might look like
  • Loading branch information
evanpurkhiser authored Jun 4, 2024
1 parent 72608c0 commit 2227d70
Show file tree
Hide file tree
Showing 5 changed files with 272 additions and 4 deletions.
254 changes: 253 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ edition = "2021"
anyhow = "1.0.66"
clap = { version = "4.4.6" }
tokio = { version = "1.28.0", features = ["macros", "sync", "tracing", "signal", "rt-multi-thread"] }
tokio-cron-scheduler = "0.10.2"

[profile.release]
lto = true
Expand Down
6 changes: 3 additions & 3 deletions src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
use std::io;

use crate::cliapp::make_app;

use tokio::signal::ctrl_c;

use crate::{cliapp::make_app, scheduler::run_scheduler};

pub async fn execute() -> io::Result<()> {
let app = make_app();
let matches = app.get_matches();

if let Some(_matches) = matches.subcommand_matches("run") {
println!("Hello uptime. I am doing nothing. ^C to exit");
run_scheduler().await.expect("Failed to run scheduler");
ctrl_c().await
} else {
unreachable!();
Expand Down
Loading

0 comments on commit 2227d70

Please sign in to comment.