diff --git a/Cargo.lock b/Cargo.lock index 312d7f9..42fd621 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2066,7 +2066,7 @@ dependencies = [ [[package]] name = "opsqueue" -version = "0.30.5" +version = "0.30.7" dependencies = [ "anyhow", "arc-swap", @@ -2120,7 +2120,7 @@ dependencies = [ [[package]] name = "opsqueue_python" -version = "0.30.5" +version = "0.30.7" dependencies = [ "anyhow", "chrono", diff --git a/libs/opsqueue_python/Cargo.toml b/libs/opsqueue_python/Cargo.toml index 1a33888..eb43975 100644 --- a/libs/opsqueue_python/Cargo.toml +++ b/libs/opsqueue_python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "opsqueue_python" -version = "0.30.6" +version = "0.30.7" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/opsqueue/Cargo.toml b/opsqueue/Cargo.toml index 07629e4..4a1a889 100644 --- a/opsqueue/Cargo.toml +++ b/opsqueue/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "opsqueue" -version = "0.30.6" +version = "0.30.7" edition = "2021" description = "lightweight batch processing queue for heavy loads" repository = "https://github.com/channable/opsqueue" diff --git a/opsqueue/app/main.rs b/opsqueue/app/main.rs index 95d4bb4..e3cc6d6 100644 --- a/opsqueue/app/main.rs +++ b/opsqueue/app/main.rs @@ -48,7 +48,7 @@ pub async fn async_main() { prometheus_config, )); - let max_age = Duration::from_secs(60 * 60); + let max_age = config.max_submission_age.into(); scope.spawn(periodically_cleanup_old(db_pool.writer_pool(), max_age)); scope.spawn(prometheus::periodically_calculate_scaling_metrics( diff --git a/opsqueue/src/config.rs b/opsqueue/src/config.rs index a56264b..08acd42 100644 --- a/opsqueue/src/config.rs +++ b/opsqueue/src/config.rs @@ -74,6 +74,9 @@ pub struct Config { /// the full submission the chunk is a part of. #[arg(long, default_value_t = 10)] pub max_chunk_retries: u32, + + #[arg(long, default_value = "1 hour")] + pub max_submission_age: humantime::Duration, } impl Default for Config { @@ -88,6 +91,7 @@ impl Default for Config { humantime::Duration::from_str("10 seconds").expect("valid humantime"); let max_missable_heartbeats = 3; let max_chunk_retries = 10; + let max_submission_age = humantime::Duration::from_str("1 hour").expect("valid humantime"); Config { port, database_filename, @@ -96,6 +100,7 @@ impl Default for Config { heartbeat_interval, max_missable_heartbeats, max_chunk_retries, + max_submission_age, } } }