From 71ba4a9c5613edab405d9e801df350f0d1d5da9c Mon Sep 17 00:00:00 2001 From: phoenix Date: Mon, 6 Jul 2026 22:53:39 -0400 Subject: [PATCH] Update rust (#14) Reviewed-on: http://git.kundeng.us/phoenix/catapult/pulls/14 --- .gitea/workflows/pr.yml | 12 +++--- Cargo.lock | 85 +++++++++-------------------------------- Cargo.toml | 10 ++--- Dockerfile | 2 +- src/app.rs | 2 - src/service/core.rs | 28 +------------- 6 files changed, 29 insertions(+), 110 deletions(-) diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index e8365a4..bc74f7e 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -14,10 +14,10 @@ jobs: name: Check runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - uses: Swatinem/rust-cache@v2 - run: | mkdir -p ~/.ssh @@ -33,10 +33,10 @@ jobs: name: Rustfmt runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - run: rustup component add rustfmt - uses: Swatinem/rust-cache@v2 - run: | @@ -53,10 +53,10 @@ jobs: name: Clippy runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96 + toolchain: 1.96.1 - run: rustup component add clippy - uses: Swatinem/rust-cache@v2 - run: | diff --git a/Cargo.lock b/Cargo.lock index 1978443..e051622 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -132,11 +132,9 @@ checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" [[package]] name = "catapult" -version = "0.3.1" +version = "0.3.2" dependencies = [ - "futures", "reqwest", - "serde", "serde_json", "swoosh", "textsender_models", @@ -147,9 +145,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.65" +version = "1.2.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e228eec9be7c17ccb640b59b36a5cd805ea2a564a4c5e162c2f659fea30d3b96" +checksum = "f5d6cac793997bd970000024b2934968efe83b382de4fdcf4fcb46b6ee4ad996" dependencies = [ "find-msvc-tools", "jobserver", @@ -305,18 +303,18 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.12" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" +checksum = "803d13fb3b09d88be9f4dbc29062c66b19bf7170867ceb746d2a8689bf6c7a26" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.21" +version = "0.8.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +checksum = "61803da095bee82a81bb1a452ecc25d3b2f1416d1897eb86430c6159ef717c17" [[package]] name = "crypto-common" @@ -529,21 +527,6 @@ version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" -[[package]] -name = "futures" -version = "0.3.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b147ee9d1f6d097cef9ce628cd2ee62288d963e16fb287bd9286455b241382d" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.32" @@ -617,7 +600,6 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" dependencies = [ - "futures-channel", "futures-core", "futures-io", "futures-macro", @@ -651,18 +633,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "getrandom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" -dependencies = [ - "cfg-if", - "libc", - "r-efi 5.3.0", - "wasip2", -] - [[package]] name = "getrandom" version = "0.4.3" @@ -672,7 +642,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "r-efi 6.0.0", + "r-efi", "rand_core", "wasm-bindgen", ] @@ -1039,11 +1009,11 @@ dependencies = [ [[package]] name = "jobserver" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" dependencies = [ - "getrandom 0.3.4", + "getrandom 0.4.3", "libc", ] @@ -1410,12 +1380,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "r-efi" -version = "5.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" - [[package]] name = "r-efi" version = "6.0.0" @@ -1651,9 +1615,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" [[package]] name = "ryu" @@ -2080,8 +2044,8 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swoosh" -version = "0.5.1" -source = "git+ssh://git@git.kundeng.us/phoenix/swoosh.git?tag=v0.5.1#d36483e6f846efd1b0b9bec6aa98194a5494669f" +version = "0.5.2" +source = "git+ssh://git@git.kundeng.us/phoenix/swoosh.git?tag=v0.5.2#50e4b209f521d8985d73a33b4a8f1db69334100a" dependencies = [ "base64-ng", "reqwest", @@ -2158,8 +2122,8 @@ dependencies = [ [[package]] name = "textsender_models" -version = "0.5.0" -source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.0#137398405fbc61acd352530f8cbfd4d98e648e95" +version = "0.5.1" +source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.1#151eeaacf64e255bde56a48df03f4c46ec77c235" dependencies = [ "const_format", "dotenvy", @@ -2534,15 +2498,6 @@ version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" -[[package]] -name = "wasip2" -version = "1.0.4+wasi-0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" -dependencies = [ - "wit-bindgen", -] - [[package]] name = "wasm-bindgen" version = "0.2.126" @@ -2772,12 +2727,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "wit-bindgen" -version = "0.57.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" - [[package]] name = "writeable" version = "0.6.3" diff --git a/Cargo.toml b/Cargo.toml index 7923636..1f2b134 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,18 +1,16 @@ [package] name = "catapult" -version = "0.3.1" -rust-version = "1.96" +version = "0.3.2" +rust-version = "1.96.1" edition = "2024" [dependencies] tokio = { version = "1.52.3", features = ["full"] } -futures = { version = "0.3.32" } reqwest = { version = "0.13.4", features = ["json", "stream", "multipart"] } -serde = { version = "1.0.228", features = ["derive"] } serde_json = { version = "1.0.150" } time = { version = "0.3.53", features = ["formatting", "macros", "parsing", "serde"] } uuid = { version = "1.23.3", features = ["v4", "serde"] } -textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.0" } -swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.1" } +textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.1" } +swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.2" } [dev-dependencies] diff --git a/Dockerfile b/Dockerfile index 1f9a801..9659b78 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Stage 1: Build the application -FROM rust:1.96 as builder +FROM rust:1.96.1 as builder # Set the working directory inside the container WORKDIR /usr/src/app diff --git a/src/app.rs b/src/app.rs index fdfe8a7..7d840e7 100644 --- a/src/app.rs +++ b/src/app.rs @@ -12,8 +12,6 @@ pub struct App { pub twilio_config: textsender_models::config::auxiliary::TwilioConfig, } -// TODO: Change this to non-async at some point. -// Will require changes in other libraries pub fn load_app() -> Result { use textsender_models::envy; let auth_url_env = envy::environment::get_env("AUTH_URL"); diff --git a/src/service/core.rs b/src/service/core.rs index 969f22d..195bf88 100644 --- a/src/service/core.rs +++ b/src/service/core.rs @@ -5,7 +5,6 @@ pub struct Service { impl Service { pub async fn do_the_work(&mut self) { - println!("Do some work"); println!("Checking queue"); use textsender_models::message::scheduling::ScheduledMessage; @@ -148,39 +147,14 @@ impl Service { } } } - - /* - todo!( - r#" - Need to finish this - - [X] - This function should fetch a token, check if the token is valid, and obtain a refresh token if - it has expired. - - Then do the real work. - - 1. Check the queue - Done - 2. If there is an item, get the data - Done - 3. Evaluate if it is schedulable - Done - 4. Get the events and iterate each one - Done - 5. Starting with the message - Done - 6. Get the contact - Done - 7. Send the message - 8. Record the message event response - Added, not used - 9. Add to scheduler - "# - ); - */ } fn is_schedulable( &self, queue_item: &textsender_models::message::scheduling::ScheduledMessage, ) -> bool { - let now = time::OffsetDateTime::now_utc(); - match queue_item.scheduled { - Some(date) => date > now, + Some(date) => date > time::OffsetDateTime::now_utc(), None => false, } }