From f4f734c98fff02a393d80981df1b394792bc7249 Mon Sep 17 00:00:00 2001 From: geofmureithi Date: Wed, 7 Oct 2026 22:42:29 +0300 Subject: [PATCH] bump: to v1.0.0-rc.11 --- ...aef8340e3503feda36a6b0098a6fe58573043.json | 12 +++++ CHANGELOG.md | 4 ++ Cargo.lock | 50 +++++++++---------- Cargo.toml | 14 +++--- examples/unique_jobs.rs | 2 +- queries/backend/vacuum_before.sql | 16 ++++++ src/queries/vacuum.rs | 12 +++++ src/queries/wait_for.rs | 4 +- supply-chain/config.toml | 24 ++++----- supply-chain/imports.lock | 4 ++ 10 files changed, 95 insertions(+), 47 deletions(-) create mode 100644 .sqlx/query-67abfe5fc47b535ac306de5d8d9aef8340e3503feda36a6b0098a6fe58573043.json create mode 100644 queries/backend/vacuum_before.sql diff --git a/.sqlx/query-67abfe5fc47b535ac306de5d8d9aef8340e3503feda36a6b0098a6fe58573043.json b/.sqlx/query-67abfe5fc47b535ac306de5d8d9aef8340e3503feda36a6b0098a6fe58573043.json new file mode 100644 index 0000000..31a37e4 --- /dev/null +++ b/.sqlx/query-67abfe5fc47b535ac306de5d8d9aef8340e3503feda36a6b0098a6fe58573043.json @@ -0,0 +1,12 @@ +{ + "db_name": "SQLite", + "query": "DELETE from\n Jobs\nWHERE\n (\n status = 'Done'\n OR status = 'Killed'\n OR (\n status = 'Failed'\n AND max_attempts <= attempts\n )\n )\n AND (\n run_at < datetime('now', '-' || ?1 || ' seconds')\n );\n\nVACUUM;\n", + "describe": { + "columns": [], + "parameters": { + "Right": 1 + }, + "nullable": [] + }, + "hash": "67abfe5fc47b535ac306de5d8d9aef8340e3503feda36a6b0098a6fe58573043" +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fb0e43..c629a65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.0.0-rc.11] - 2026-10-07 + +- bump: to v1.0.0-rc.11 + ## [1.0.0-rc.10] - 2026-10-02 - fix: compile alongside sqlx PostgreSQL driver when pushing tasks (#112) diff --git a/Cargo.lock b/Cargo.lock index 76a6117..095072d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "apalis" -version = "1.0.0-rc.10" +version = "1.0.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc96f8162b465147c3bbf0fe27b3803d468456823d1e2e5db17a3cc9206f1ccc" +checksum = "0999b56c5cdf510f4bbc65dbf236bc196e16a52d42fee6ca9ce58484db6fecd1" dependencies = [ "apalis-core", "futures-util", @@ -34,9 +34,9 @@ dependencies = [ [[package]] name = "apalis-codec" -version = "0.1.0-rc.10" +version = "0.1.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f5cac07535fe1fd62ed316a2068c0efd886f41c2b1bf326f5d0d774fa523a3" +checksum = "6256b897e40ba6c99f137a331ff8af7811ff5a2fe5439c337b26df68e970f561" dependencies = [ "apalis-core", "bincode", @@ -48,9 +48,9 @@ dependencies = [ [[package]] name = "apalis-core" -version = "1.0.0-rc.10" +version = "1.0.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736bb41e6475dafb9489fe67302f787381d5a511dbfa039cfe69e585bda6956a" +checksum = "f495fd1d64babf4d77d7f9caa167d0c807e3213af3e0513b8d42d07e6b4e3b88" dependencies = [ "dashmap", "futures-channel", @@ -71,7 +71,7 @@ dependencies = [ [[package]] name = "apalis-sqlite" -version = "1.0.0-rc.10" +version = "1.0.0-rc.11" dependencies = [ "apalis", "apalis-codec", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "apalis-workflow" -version = "0.1.0-rc.10" +version = "0.1.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "018253861e1cc1c9ec33d7b89bcfc60b38588d653aaab85555b122184cae5faa" +checksum = "1622bd2b7cac4617b075007a27839d38efb10cf3acb4ec53edefd7dcc68ef97e" dependencies = [ "apalis-codec", "apalis-core", @@ -343,9 +343,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "cc" -version = "1.5.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f360145194ee8e21db5ee7f3fcd4fe52210864c75c985dae33218202c8bbe040" +checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630" dependencies = [ "find-msvc-tools", "shlex", @@ -468,9 +468,9 @@ dependencies = [ [[package]] name = "ctutils" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5515a3834141de9eafb9717ad39eea8247b5674e6066c404e8c4b365d2a29e" +checksum = "03bb0e1cc970d482d121d9a1744999169b69a07470b3d644a7894e53fcaf4574" dependencies = [ "cmov", ] @@ -529,9 +529,9 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "252afb9ae5eaa683babdc6a068b3f5726eb19e05070c731f9b2a23a7c3e8ed34" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" dependencies = [ "serde", ] @@ -1050,9 +1050,9 @@ checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb" [[package]] name = "libc" -version = "0.2.189" +version = "0.2.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eaf3ede3fee6db1a4c2ee091bf8a8b4dccdc6d17f656fb07896ee72867612f2" +checksum = "ce5d3ddc6d3fa000eb1536d85e147bfe31aacaba692ed6a876f95cb7c855be78" [[package]] name = "libsqlite3-sys" @@ -1122,9 +1122,9 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "mio" -version = "1.2.3" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b18443e9c262bfe8fa82f51666e2642c53393f7e5c27b3e1aeab922cff5b9d8" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" dependencies = [ "libc", "wasi", @@ -1957,9 +1957,9 @@ checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" [[package]] name = "tokio" -version = "1.53.1" +version = "1.53.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "202caea871b69668250d242070849eb495be178ed697a3e98aebce5bc81a0bed" +checksum = "e95f91fcc7a621e8b030f6aa23c71fe9838ae2fb4d8118b75602a328f5144044" dependencies = [ "bytes", "libc", @@ -2173,9 +2173,9 @@ checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" [[package]] name = "uuid" -version = "1.26.1" +version = "1.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ef6dac1e96601b4fb3acccccff2139741fcb757cb9a36089bf5be91cfb285ce" +checksum = "97277d36b9c3ace13e58fa6e753f8b0bbbf302a18dd193240d70f9e29681059a" dependencies = [ "getrandom 0.4.3", "js-sys", @@ -2441,9 +2441,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e13c156562582aa81c60cb29407084cdb54c4164760106ab78e6c5b0858cf64e" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" [[package]] name = "zerotrie" diff --git a/Cargo.toml b/Cargo.toml index 6994a8d..d2e9ffc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apalis-sqlite" -version = "1.0.0-rc.10" +version = "1.0.0-rc.11" authors = ["Njuguna Mureithi "] readme = "README.md" edition = "2024" @@ -31,21 +31,21 @@ features = ["sqlite"] [dependencies] serde = { version = "1", features = ["derive"] } serde_json = { version = "1" } -apalis-codec = { version = "0.1.0-rc.10", default-features = false } -apalis-core = { version = "1.0.0-rc.10", features = ["sleep", "ulid"] } +apalis-codec = { version = "0.1.0-rc.11", default-features = false } +apalis-core = { version = "1.0.0-rc.11", features = ["sleep", "ulid"] } log = "0.4.34" futures = "0.3.34" tokio = { version = "1", features = ["rt", "net"], optional = true } async-std = { version = "1.13.2", optional = true } -thiserror = "2.0.20" +thiserror = "2.0.21" pin-project = "1.1.13" ulid = { version = "3", features = ["serde"] } [dev-dependencies] tokio = { version = "1", features = ["macros", "rt-multi-thread"] } -apalis = { version = "1.0.0-rc.10", features = ["retry"] } -apalis-workflow = { version = "0.1.0-rc.10" } -apalis-codec = { version = "0.1.0-rc.10", features = ["msgpack", "bincode"] } +apalis = { version = "1.0.0-rc.11", features = ["retry", "task-context"] } +apalis-workflow = { version = "0.1.0-rc.11" } +apalis-codec = { version = "0.1.0-rc.11", features = ["msgpack", "bincode"] } futures-util = "0.3.34" tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } diff --git a/examples/unique_jobs.rs b/examples/unique_jobs.rs index b300e7b..576f97c 100644 --- a/examples/unique_jobs.rs +++ b/examples/unique_jobs.rs @@ -18,8 +18,8 @@ async fn main() { backend.push_task(task_2).await.unwrap(); async fn task(task: u32, worker: WorkerContext) -> Result<(), BoxDynError> { - apalis_core::timer::sleep(std::time::Duration::from_secs(1)).await; assert_eq!(task, 42); + apalis_core::timer::sleep(std::time::Duration::from_secs(1)).await; worker.stop()?; Ok(()) } diff --git a/queries/backend/vacuum_before.sql b/queries/backend/vacuum_before.sql new file mode 100644 index 0000000..16a37d7 --- /dev/null +++ b/queries/backend/vacuum_before.sql @@ -0,0 +1,16 @@ +DELETE from + Jobs +WHERE + ( + status = 'Done' + OR status = 'Killed' + OR ( + status = 'Failed' + AND max_attempts <= attempts + ) + ) + AND ( + run_at < datetime('now', '-' || ?1 || ' seconds') + ); + +VACUUM; diff --git a/src/queries/vacuum.rs b/src/queries/vacuum.rs index 23f6567..9afce7b 100644 --- a/src/queries/vacuum.rs +++ b/src/queries/vacuum.rs @@ -1,3 +1,5 @@ +use std::time::Duration; + use apalis_core::backend::{Backend, Vacuum}; use crate::{Error, SqliteStorage}; @@ -13,4 +15,14 @@ where .await?; Ok(res.rows_affected() as usize) } + + async fn vacuum_before(&mut self, duration: Duration) -> Result { + let res = sqlx::query_file!( + "queries/backend/vacuum_before.sql", + duration.as_secs() as i64 + ) + .execute(&self.persistence.pool) + .await?; + Ok(res.rows_affected() as usize) + } } diff --git a/src/queries/wait_for.rs b/src/queries/wait_for.rs index be0b4d2..b46e918 100644 --- a/src/queries/wait_for.rs +++ b/src/queries/wait_for.rs @@ -25,7 +25,7 @@ where O: Send + 'static + serde::de::DeserializeOwned, { type ResultStream = BoxStream<'static, Result, Self::Error>>; - fn wait_for(&self, task_ids: impl IntoIterator) -> Self::ResultStream { + fn wait_for(&mut self, task_ids: impl IntoIterator) -> Self::ResultStream { let pool = self.persistence.pool.clone(); let ids: HashSet = task_ids.into_iter().map(|id| id.to_string()).collect(); @@ -74,7 +74,7 @@ where // Implementation of check_status fn check_status( - &self, + &mut self, task_ids: impl IntoIterator + Send, ) -> impl Future>, Self::Error>> + Send { let pool = self.persistence.pool.clone(); diff --git a/supply-chain/config.toml b/supply-chain/config.toml index db9d490..0e0d28c 100644 --- a/supply-chain/config.toml +++ b/supply-chain/config.toml @@ -16,15 +16,15 @@ version = "0.2.21" criteria = "safe-to-deploy" [[exemptions.apalis]] -version = "1.0.0-rc.10" +version = "1.0.0-rc.11" criteria = "safe-to-run" [[exemptions.apalis-codec]] -version = "0.1.0-rc.10" +version = "0.1.0-rc.11" criteria = "safe-to-deploy" [[exemptions.apalis-core]] -version = "1.0.0-rc.10" +version = "1.0.0-rc.11" criteria = "safe-to-deploy" [[exemptions.apalis-sqlite]] @@ -32,7 +32,7 @@ version = "1.0.0-rc.2" criteria = "safe-to-deploy" [[exemptions.apalis-workflow]] -version = "0.1.0-rc.10" +version = "0.1.0-rc.11" criteria = "safe-to-run" [[exemptions.async-channel]] @@ -124,7 +124,7 @@ version = "1.12.1" criteria = "safe-to-deploy" [[exemptions.cc]] -version = "1.5.1" +version = "1.6.0" criteria = "safe-to-deploy" [[exemptions.cfg-if]] @@ -184,7 +184,7 @@ version = "0.2.2" criteria = "safe-to-deploy" [[exemptions.ctutils]] -version = "0.4.2" +version = "0.4.3" criteria = "safe-to-deploy" [[exemptions.dashmap]] @@ -208,7 +208,7 @@ version = "0.15.7" criteria = "safe-to-deploy" [[exemptions.either]] -version = "1.18.0" +version = "1.19.0" criteria = "safe-to-deploy" [[exemptions.equivalent]] @@ -436,7 +436,7 @@ version = "1.5.1" criteria = "safe-to-run" [[exemptions.libc]] -version = "0.2.189" +version = "0.2.190" criteria = "safe-to-deploy" [[exemptions.libsqlite3-sys]] @@ -472,7 +472,7 @@ version = "2.8.3" criteria = "safe-to-deploy" [[exemptions.mio]] -version = "1.2.3" +version = "1.2.4" criteria = "safe-to-deploy" [[exemptions.native-tls]] @@ -776,7 +776,7 @@ version = "1.13.3" criteria = "safe-to-deploy" [[exemptions.tokio]] -version = "1.53.1" +version = "1.53.2" criteria = "safe-to-deploy" [[exemptions.tokio-macros]] @@ -864,7 +864,7 @@ version = "1.0.4" criteria = "safe-to-deploy" [[exemptions.uuid]] -version = "1.26.1" +version = "1.27.0" criteria = "safe-to-deploy" [[exemptions.valuable]] @@ -992,7 +992,7 @@ version = "0.1.8" criteria = "safe-to-deploy" [[exemptions.zeroize]] -version = "1.9.0" +version = "1.9.1" criteria = "safe-to-deploy" [[exemptions.zerotrie]] diff --git a/supply-chain/imports.lock b/supply-chain/imports.lock index a60818c..9a8469f 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -28,3 +28,7 @@ audited_as = "1.0.0-rc.8" [[unpublished.apalis-sqlite]] version = "1.0.0-rc.10" audited_as = "1.0.0-rc.9" + +[[unpublished.apalis-sqlite]] +version = "1.0.0-rc.11" +audited_as = "1.0.0-rc.10"