From 036606315eef95a18f52ddafbebd05996cd1e72c Mon Sep 17 00:00:00 2001 From: geofmureithi Date: Thu, 8 Oct 2026 16:04:24 +0300 Subject: [PATCH] bump: to v1.0.0-rc.10 --- ...0783d4d88e1305d96ffd71ed5812b7ac1c908.json | 15 ++ ...56ecdf83fd9623feb0cbcb5a1e3af7afed4f.json} | 4 +- CHANGELOG.md | 14 +- Cargo.lock | 155 ++++++++++-------- Cargo.toml | 34 +++- queries/backend/keep_alive.sql | 2 +- queries/backend/keep_alive_untracked.sql | 7 + src/backend.rs | 19 ++- src/error.rs | 14 +- src/lib.rs | 7 + src/queries/keep_alive.rs | 44 ++++- src/queries/wait_for.rs | 4 +- supply-chain/config.toml | 66 ++++---- supply-chain/imports.lock | 4 + 14 files changed, 272 insertions(+), 117 deletions(-) create mode 100644 .sqlx/query-3c9deb0bd7c599646457e7b0d9b0783d4d88e1305d96ffd71ed5812b7ac1c908.json rename .sqlx/{query-75a941c14fe29a7d1a4d64d70ca39dacfbc047c8051eafbd521a6a9d7845dfda.json => query-c2d59182f70042200eb50d9a7d7756ecdf83fd9623feb0cbcb5a1e3af7afed4f.json} (81%) create mode 100644 queries/backend/keep_alive_untracked.sql diff --git a/.sqlx/query-3c9deb0bd7c599646457e7b0d9b0783d4d88e1305d96ffd71ed5812b7ac1c908.json b/.sqlx/query-3c9deb0bd7c599646457e7b0d9b0783d4d88e1305d96ffd71ed5812b7ac1c908.json new file mode 100644 index 0000000..7a4d3c5 --- /dev/null +++ b/.sqlx/query-3c9deb0bd7c599646457e7b0d9b0783d4d88e1305d96ffd71ed5812b7ac1c908.json @@ -0,0 +1,15 @@ +{ + "db_name": "PostgreSQL", + "query": "UPDATE\n apalis.workers w\nSET\n last_seen = NOW()\nWHERE\n w.id = $1\n AND w.worker_type = $2;\n", + "describe": { + "columns": [], + "parameters": { + "Left": [ + "Text", + "Text" + ] + }, + "nullable": [] + }, + "hash": "3c9deb0bd7c599646457e7b0d9b0783d4d88e1305d96ffd71ed5812b7ac1c908" +} diff --git a/.sqlx/query-75a941c14fe29a7d1a4d64d70ca39dacfbc047c8051eafbd521a6a9d7845dfda.json b/.sqlx/query-c2d59182f70042200eb50d9a7d7756ecdf83fd9623feb0cbcb5a1e3af7afed4f.json similarity index 81% rename from .sqlx/query-75a941c14fe29a7d1a4d64d70ca39dacfbc047c8051eafbd521a6a9d7845dfda.json rename to .sqlx/query-c2d59182f70042200eb50d9a7d7756ecdf83fd9623feb0cbcb5a1e3af7afed4f.json index 102964f..5410fa6 100644 --- a/.sqlx/query-75a941c14fe29a7d1a4d64d70ca39dacfbc047c8051eafbd521a6a9d7845dfda.json +++ b/.sqlx/query-c2d59182f70042200eb50d9a7d7756ecdf83fd9623feb0cbcb5a1e3af7afed4f.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "UPDATE apalis.workers w\nSET last_seen = NOW()\nWHERE\n w.id = $1\n AND w.worker_type = $2\n AND (\n SELECT COUNT(*)\n FROM apalis.jobs j\n WHERE j.lock_by = w.id\n AND j.id = ANY($3::text[])\n ) = cardinality($3::text[]);\n", + "query": "UPDATE apalis.workers w\nSET last_seen = NOW()\nWHERE\n w.id = $1\n AND w.worker_type = $2\n AND (\n SELECT COUNT(*)\n FROM apalis.jobs j\n WHERE j.lock_by = w.id\n AND j.id = ANY($3::text[])\n ) = cardinality($3::text[]); \n", "describe": { "columns": [], "parameters": { @@ -12,5 +12,5 @@ }, "nullable": [] }, - "hash": "75a941c14fe29a7d1a4d64d70ca39dacfbc047c8051eafbd521a6a9d7845dfda" + "hash": "c2d59182f70042200eb50d9a7d7756ecdf83fd9623feb0cbcb5a1e3af7afed4f" } diff --git a/CHANGELOG.md b/CHANGELOG.md index f5c928c..8dcfc90 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.10] - 2026-10-08 + +- bump: introducing rc.10 + ## [1.0.0-rc.9] - 2026-09-17 - fix: confine apalis's objects to the `apalis` schema (#86): @@ -50,11 +54,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [1.0.0-beta.3] - 2025-12-06 -- fix: correct allowSelfAssign param as bool (#25) +- fix: correct allowSelfAssign param as bool (#25) - fix: ensure automated release (#27) - fix: ensure workflow_call (#28) - ## [0.7.1] - 2025-03-17 ### 🐛 Bug Fixes @@ -66,31 +69,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Generic retry persist check (#498) - Add associated types to the `Backend` trait (#516) + ## [0.6.4] - 2024-12-03 ### 🐛 Bug Fixes - Allow polling only when worker is ready (#472) + ## [0.5.5] - 2024-05-20 ### 🐛 Bug Fixes - Wrong timestamp type for pg (#321) + ## [0.4.9] - 2024-01-03 ### 🚀 Features - Configurable worker set as dead (#220) + ## [0.4.7] - 2023-11-15 ### 🐛 Bug Fixes - Allow cargo build --all-features (#204) + ## [0.4.5] - 2023-10-08 ### 💼 Other - Api to get migrations + ## [0.4.4] - 2023-07-31 ### 🐛 Bug Fixes @@ -100,4 +109,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### 💼 Other - Sqlx to v0.7 + ## [0.3.0] - 2022-06-05 diff --git a/Cargo.lock b/Cargo.lock index 11c6e97..fd54910 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", "serde", @@ -45,9 +45,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", @@ -68,13 +68,14 @@ dependencies = [ [[package]] name = "apalis-postgres" -version = "1.0.0-rc.9" +version = "1.0.0-rc.10" dependencies = [ "apalis", "apalis-codec", "apalis-core", "apalis-workflow", "async-std", + "document-features", "futures", "futures-util", "once_cell", @@ -92,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", @@ -322,9 +323,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "cc" -version = "1.4.6" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3eb0f42d6c360dc3f8a821f6bf2fdea7f72bfd36b3076eb0e6d1e9e0752fff4" +checksum = "f74872d07caf508b30a21f6836e7d7016a2eaf7d9ff4f48deaa58cd8a0407630" dependencies = [ "find-msvc-tools", "shlex", @@ -447,9 +448,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", ] @@ -497,7 +498,16 @@ checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", +] + +[[package]] +name = "document-features" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61" +dependencies = [ + "litrs", ] [[package]] @@ -508,9 +518,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", ] @@ -575,9 +585,9 @@ checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" [[package]] name = "find-msvc-tools" -version = "0.1.12" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e0f1c7c3a72c66fd80abe965175f7523475c0489a87d3ff9d6e8c87d87a9d2d" +checksum = "aedcfb3409746eddb02b9e19ebda1c3394f759a152e48ee875a0844d1b955484" [[package]] name = "fixedbitset" @@ -712,7 +722,7 @@ checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", ] [[package]] @@ -1003,9 +1013,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "js-sys" -version = "0.3.105" +version = "0.3.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce57d20d1ea864ce2ac172ab472d409214f4fd359f0b2a2775abdf522e2af99e" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" dependencies = [ "cfg-if", "futures-util", @@ -1023,15 +1033,15 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +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" @@ -1055,6 +1065,12 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" +[[package]] +name = "litrs" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092" + [[package]] name = "lock_api" version = "0.4.14" @@ -1100,9 +1116,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", @@ -1269,9 +1285,9 @@ checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" [[package]] name = "pin-utils" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +checksum = "13bee6c73da26345c729282832b60b0363cf3dd9f4bfd81d8551b7a1c889a113" [[package]] name = "piper" @@ -1339,9 +1355,9 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "rand" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7f5fa3a058cd35567ef9bfa5e75732bee0f9e4c55fa90477bef2dfcdbc4be80" +checksum = "65c9fb96cbc91e3478eaae79a69fcd3f1ae4ad052e471fe6732fff548984b4af" dependencies = [ "chacha20", "getrandom 0.4.3", @@ -1396,9 +1412,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +checksum = "891efababe418670775f199f0d233d84843c227a0949a883ce15b37c78d6629d" dependencies = [ "bitflags", "errno", @@ -1512,7 +1528,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", ] [[package]] @@ -1599,9 +1615,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" [[package]] name = "smallvec" -version = "1.16.1" +version = "1.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba467056f1b547ed52077911161fc86985becbc60e8e1857c8a144dab0def891" +checksum = "f9395f0f0eee849a9b707b2f06bb92a6a422090e2123bb2ef8e87a0e61892a8e" dependencies = [ "serde", ] @@ -1840,9 +1856,9 @@ dependencies = [ [[package]] name = "syn" -version = "3.0.5" +version = "3.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12df2e0110f65b775f769bb17ef989067a1d931b2eb822bd4346631eeada89f9" +checksum = "8593e8e72159ed2257d083c7a454a85cbf854f37a0966d8d483aff8c8a3ebcee" dependencies = [ "proc-macro2", "quote", @@ -1863,7 +1879,7 @@ checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", ] [[package]] @@ -1881,22 +1897,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.20" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec86235f5fcc2a73650310756d2ac5b138a5780bbbdfae3eeccec992c435ba4f" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.20" +version = "2.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc04cd3e1236dd4a98afca4569f2deb3f120e5422a4023be2cb683f8486292af" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", ] [[package]] @@ -1926,9 +1942,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", @@ -1947,7 +1963,7 @@ checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", ] [[package]] @@ -2132,9 +2148,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab72a15cf68d77cb0987d3684aa8a45c5ef827e8cb49ee2f30bfd7ba2feb519f" +checksum = "d245f478577f809a851594d02313b640fb437e0bb33866753cff937863096954" [[package]] name = "unicode-normalization" @@ -2177,9 +2193,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", @@ -2220,9 +2236,9 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasm-bindgen" -version = "0.2.128" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aecb87a33d3b0c5e3b7aa46336eaf486cffafbd281b195e4c8b80d50df2351bf" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" dependencies = [ "cfg-if", "once_cell", @@ -2233,19 +2249,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.78" +version = "0.4.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ef4c5d3d2cdf5c54f4231181768f5510842e350db025faf1f7163b1030ed928" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" dependencies = [ "js-sys", + "tokio", "wasm-bindgen", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.128" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a690d511e3c1a8b3a55e33511e3c2c00c78415cd23650f32b808627f5696b9ed" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2253,22 +2270,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.128" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "411e4887f0071ef2d2164a9d5fdf2d20efbef78fccd3a78b0c10a1dc5295e48a" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" dependencies = [ "bumpalo", "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.128" +version = "0.2.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81941cd78d0c92026c33e5e01312845a4cb1e9af3407f9134b100dd03144103e" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" dependencies = [ "unicode-ident", ] @@ -2414,13 +2431,13 @@ dependencies = [ [[package]] name = "yoke-derive" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33811428bee40dbceb6d545e95754741d17a6aef9a4849f0fd62e2ba4f412a78" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", "synstructure", ] @@ -2441,15 +2458,15 @@ checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", "synstructure", ] [[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" @@ -2481,7 +2498,7 @@ checksum = "34df6fc39dbd26ddc9c10e6a2984476e13acce22e64e4487636ef494369225da" dependencies = [ "proc-macro2", "quote", - "syn 3.0.5", + "syn 3.0.6", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3548e1b..112fa86 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "apalis-postgres" -version = "1.0.0-rc.9" +version = "1.0.0-rc.10" authors = ["Njuguna Mureithi "] edition = "2024" repository = "https://github.com/apalis-dev/apalis-postgres" @@ -15,22 +15,33 @@ publish = true [features] default = ["migrate", "tokio-comp"] +## Enables fine-grained worker and task tracking +task-tracking = ["apalis-core/task-context"] + +## Enable migrations and macros for sqlx migrate = ["sqlx/migrate", "sqlx/macros"] +## Enable the async-std runtime for sqlx async-std-comp = ["async-std", "sqlx/runtime-async-std", "sqlx/tls-rustls"] +## Enable the async-std runtime for sqlx with native-tls async-std-comp-native-tls = [ "async-std", "sqlx/runtime-async-std", "sqlx/tls-native-tls", ] +## Enable the tokio runtime for sqlx tokio-comp = ["tokio", "sqlx/runtime-tokio", "sqlx/tls-rustls"] +## Enable the tokio runtime for sqlx with native-tls tokio-comp-native-tls = ["tokio", "sqlx/runtime-tokio", "sqlx/tls-native-tls"] + +docsrs = ["dep:document-features"] + [dependencies] -apalis-core = { version = "1.0.0-rc.10", default-features = false, features = [ +apalis-core = { version = "1.0.0-rc.11", default-features = false, features = [ "sleep", "ulid", ] } -apalis-codec = { version = "0.1.0-rc.10", features = ["json"] } +apalis-codec = { version = "0.1.0-rc.11", features = ["json"] } serde = { version = "1", features = ["derive"], default-features = false } pin-project = "1.1.13" serde_json = "1" @@ -50,11 +61,24 @@ version = "0.9" default-features = false features = ["postgres", "json", "sqlx-toml"] +[dependencies.document-features] +version = "0.2" +optional = true + + [dev-dependencies] tokio = { version = "1", features = ["macros", "rt-multi-thread"] } once_cell = "1.21.4" -apalis = { version = "1.0.0-rc.10" } -apalis-workflow = { version = "0.1.0-rc.10" } +apalis = { version = "1.0.0-rc.11" } +apalis-workflow = { version = "0.1.0-rc.11" } futures-util = "0.3.34" tracing-subscriber = { version = "0.3.23", features = ["env-filter"] } tokio-util = "0.7.19" + +[package.metadata.docs.rs] +# defines the configuration attribute `docsrs` +rustdoc-args = ["--cfg", "docsrs"] +all-features = true + +[package.metadata.cargo-udeps.ignore] +normal = ["document-features"] diff --git a/queries/backend/keep_alive.sql b/queries/backend/keep_alive.sql index c581742..40e74e3 100644 --- a/queries/backend/keep_alive.sql +++ b/queries/backend/keep_alive.sql @@ -8,4 +8,4 @@ WHERE FROM apalis.jobs j WHERE j.lock_by = w.id AND j.id = ANY($3::text[]) - ) = cardinality($3::text[]); + ) = cardinality($3::text[]); diff --git a/queries/backend/keep_alive_untracked.sql b/queries/backend/keep_alive_untracked.sql new file mode 100644 index 0000000..ee42e75 --- /dev/null +++ b/queries/backend/keep_alive_untracked.sql @@ -0,0 +1,7 @@ +UPDATE + apalis.workers w +SET + last_seen = NOW() +WHERE + w.id = $1 + AND w.worker_type = $2; diff --git a/src/backend.rs b/src/backend.rs index f64b56f..a8a1947 100644 --- a/src/backend.rs +++ b/src/backend.rs @@ -103,10 +103,21 @@ impl PostgresStorage<()> { /// Returns an error if the migrations cannot be applied to the database. #[cfg(feature = "migrate")] pub async fn setup(pool: &PgPool) -> Result<(), Error> { - Self::migrations() - .run(pool) - .await - .map_err(sqlx::Error::from)?; + Self::migrations().run(pool).await.map_err(|r| { + use sqlx::migrate::MigrateError::VersionMismatch; + + if let VersionMismatch(20220530084123) = r { + Error::UpgradeRequired { + current: "0.7.4".into(), + required: "1.0.0".into(), + link: Some( + "https://github.com/apalis-dev/apalis-postgres#upgrading-to-10".into(), + ), + } + } else { + Error::Database(r.into()) + } + })?; Ok(()) } diff --git a/src/error.rs b/src/error.rs index a73121b..2b71eba 100644 --- a/src/error.rs +++ b/src/error.rs @@ -18,7 +18,7 @@ pub enum Error { abandoned: usize, }, /// Error decoding the task_id - #[error("TaskIdError: {0}")] + #[error("TaskId Error: {0}")] TaskIdError(TaskIdError), /// Error decoding the task status #[error("StatusError: {0}")] @@ -30,4 +30,16 @@ pub enum Error { /// Tried to register a worker that already exists #[error("WorkerAlreadyExists: {0}")] WorkerAlreadyExists(String), + + #[error( + "UpgradeRequired: Current version {current}, Required version {required}. \n Link: {link:?}" + )] + UpgradeRequired { + /// The current version of the migrations in the database + current: String, + /// The required version of the migrations in the database + required: String, + /// Optional link to the migration guide + link: Option, + }, } diff --git a/src/lib.rs b/src/lib.rs index 244ce37..a5decc1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,5 +1,12 @@ +#![cfg_attr(docsrs, feature(doc_cfg))] #![doc = include_str!("../README.md")] //! +//! # Feature flags +#![cfg_attr( + feature = "docsrs", + cfg_attr(doc, doc = ::document_features::document_features!()) +)] +//! //! [`PostgresStorageWithListener`]: crate::PostgresStorage //! [`PostgresStorageFactory`]: crate::factory::PostgresStorageFactory diff --git a/src/queries/keep_alive.rs b/src/queries/keep_alive.rs index db7534d..fc985ad 100644 --- a/src/queries/keep_alive.rs +++ b/src/queries/keep_alive.rs @@ -8,18 +8,58 @@ pub async fn keep_alive(conn: &mut E, queue: &str, worker: &WorkerContext) -> where for<'e> &'e mut E: Executor<'e, Database = sqlx::Postgres>, { + if cfg!(feature = "task-tracking") { + keep_alive_tracked(conn, queue, worker).await + } else { + keep_alive_untracked(conn, queue, worker).await + } +} + +async fn keep_alive_tracked( + conn: &mut E, + queue: &str, + worker: &WorkerContext, +) -> Result<(), Error> +where + for<'e> &'e mut E: Executor<'e, Database = sqlx::Postgres>, +{ + #[cfg(feature = "task-tracking")] let tasks = worker .tasks() + .map_err(|_| Error::WorkerOutOfSync)? .iter() - .map(|task| task.task_id().to_string()) + .map(|task| task.task_id().to_owned()) .collect::>(); + //We will never reach this point if the feature is not enabled + #[cfg(not(feature = "task-tracking"))] + let tasks: Vec = vec![]; + let worker = worker.name(); let res = sqlx::query_file!("queries/backend/keep_alive.sql", worker, queue, &tasks) .execute(conn) .await?; - if res.rows_affected() == 0 { + if res.rows_affected() != 1 { + return Err(Error::WorkerOutOfSync); + } + Ok(()) +} + +async fn keep_alive_untracked( + conn: &mut E, + queue: &str, + worker: &WorkerContext, +) -> Result<(), Error> +where + for<'e> &'e mut E: Executor<'e, Database = sqlx::Postgres>, +{ + let worker = worker.name(); + + let res = sqlx::query_file!("queries/backend/keep_alive_untracked.sql", worker, queue) + .execute(conn) + .await?; + if res.rows_affected() != 1 { return Err(Error::WorkerOutOfSync); } Ok(()) diff --git a/src/queries/wait_for.rs b/src/queries/wait_for.rs index b15ff3f..a560bcc 100644 --- a/src/queries/wait_for.rs +++ b/src/queries/wait_for.rs @@ -26,7 +26,7 @@ where Result: 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 ids: HashSet = task_ids.into_iter().map(|id| id.to_string()).collect(); let pool = self.persistence.pool.clone(); let stream = futures::stream::unfold(ids, move |mut remaining_ids| { @@ -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 73f3853..bc242ca 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-postgres]] @@ -32,7 +32,7 @@ version = "1.0.0-beta.3" 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]] @@ -116,7 +116,7 @@ version = "1.12.1" criteria = "safe-to-deploy" [[exemptions.cc]] -version = "1.4.6" +version = "1.6.0" criteria = "safe-to-deploy" [[exemptions.cfg-if]] @@ -176,7 +176,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]] @@ -195,12 +195,16 @@ criteria = "safe-to-deploy" version = "0.2.7" criteria = "safe-to-deploy" +[[exemptions.document-features]] +version = "0.2.12" +criteria = "safe-to-deploy" + [[exemptions.dotenvy]] version = "0.15.7" criteria = "safe-to-deploy" [[exemptions.either]] -version = "1.18.0" +version = "1.19.0" criteria = "safe-to-deploy" [[exemptions.equivalent]] @@ -232,7 +236,7 @@ version = "2.5.0" criteria = "safe-to-deploy" [[exemptions.find-msvc-tools]] -version = "0.1.12" +version = "0.1.14" criteria = "safe-to-deploy" [[exemptions.fixedbitset]] @@ -416,7 +420,7 @@ version = "1.0.18" criteria = "safe-to-deploy" [[exemptions.js-sys]] -version = "0.3.105" +version = "0.3.106" criteria = "safe-to-deploy" [[exemptions.kv-log-macro]] @@ -424,11 +428,11 @@ version = "1.0.7" criteria = "safe-to-deploy" [[exemptions.lazy_static]] -version = "1.5.0" +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]] @@ -443,6 +447,10 @@ criteria = "safe-to-deploy" version = "0.8.3" criteria = "safe-to-deploy" +[[exemptions.litrs]] +version = "1.0.0" +criteria = "safe-to-deploy" + [[exemptions.lock_api]] version = "0.4.14" criteria = "safe-to-deploy" @@ -464,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]] @@ -532,7 +540,7 @@ version = "0.2.17" criteria = "safe-to-deploy" [[exemptions.pin-utils]] -version = "0.1.0" +version = "0.1.1" criteria = "safe-to-deploy" [[exemptions.piper]] @@ -564,7 +572,7 @@ version = "6.0.0" criteria = "safe-to-deploy" [[exemptions.rand]] -version = "0.10.2" +version = "0.10.3" criteria = "safe-to-deploy" [[exemptions.rand_core]] @@ -588,7 +596,7 @@ version = "0.17.14" criteria = "safe-to-deploy" [[exemptions.rustix]] -version = "1.1.4" +version = "1.1.5" criteria = "safe-to-deploy" [[exemptions.rustls]] @@ -672,7 +680,7 @@ version = "0.4.12" criteria = "safe-to-deploy" [[exemptions.smallvec]] -version = "1.16.1" +version = "1.16.2" criteria = "safe-to-deploy" [[exemptions.socket2]] @@ -728,7 +736,7 @@ version = "2.0.119" criteria = "safe-to-deploy" [[exemptions.syn]] -version = "3.0.5" +version = "3.0.6" criteria = "safe-to-deploy" [[exemptions.sync_wrapper]] @@ -744,11 +752,11 @@ version = "3.27.0" criteria = "safe-to-deploy" [[exemptions.thiserror]] -version = "2.0.20" +version = "2.0.21" criteria = "safe-to-deploy" [[exemptions.thiserror-impl]] -version = "2.0.20" +version = "2.0.21" criteria = "safe-to-deploy" [[exemptions.thread_local]] @@ -764,7 +772,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]] @@ -840,7 +848,7 @@ version = "0.3.18" criteria = "safe-to-deploy" [[exemptions.unicode-ident]] -version = "1.0.25" +version = "1.0.26" criteria = "safe-to-deploy" [[exemptions.unicode-normalization]] @@ -864,7 +872,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]] @@ -888,23 +896,23 @@ version = "0.11.1+wasi-snapshot-preview1" criteria = "safe-to-deploy" [[exemptions.wasm-bindgen]] -version = "0.2.128" +version = "0.2.129" criteria = "safe-to-deploy" [[exemptions.wasm-bindgen-futures]] -version = "0.4.78" +version = "0.4.79" criteria = "safe-to-deploy" [[exemptions.wasm-bindgen-macro]] -version = "0.2.128" +version = "0.2.129" criteria = "safe-to-deploy" [[exemptions.wasm-bindgen-macro-support]] -version = "0.2.128" +version = "0.2.129" criteria = "safe-to-deploy" [[exemptions.wasm-bindgen-shared]] -version = "0.2.128" +version = "0.2.129" criteria = "safe-to-deploy" [[exemptions.web-time]] @@ -980,7 +988,7 @@ version = "0.8.3" criteria = "safe-to-deploy" [[exemptions.yoke-derive]] -version = "0.8.3" +version = "0.8.4" criteria = "safe-to-deploy" [[exemptions.zerofrom]] @@ -992,7 +1000,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 238891c..172d16d 100644 --- a/supply-chain/imports.lock +++ b/supply-chain/imports.lock @@ -32,3 +32,7 @@ audited_as = "1.0.0-rc.7" [[unpublished.apalis-postgres]] version = "1.0.0-rc.9" audited_as = "1.0.0-rc.8" + +[[unpublished.apalis-postgres]] +version = "1.0.0-rc.10" +audited_as = "1.0.0-rc.9"