diff --git a/Cargo.lock b/Cargo.lock index 44402bb..48b3044 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2548,12 +2548,6 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - [[package]] name = "want" version = "0.3.1" @@ -2830,7 +2824,7 @@ dependencies = [ "dotenv", "html-escape", "log", - "rand 0.8.8", + "rand 0.10.2", "regex", "reqwest", "serde", @@ -2855,7 +2849,7 @@ dependencies = [ "parking_lot", "png", "pretty_env_logger", - "rand 0.8.8", + "rand 0.10.2", "rusqlite", "serde", "serde_json", diff --git a/crates/x-media/Cargo.toml b/crates/x-media/Cargo.toml index 3fe588d..72b1d28 100644 --- a/crates/x-media/Cargo.toml +++ b/crates/x-media/Cargo.toml @@ -14,7 +14,7 @@ bytes = "1" zip = "8" tempfile = "3" thiserror = "2" -rand = "0.8" +rand = "0.10" log = "0.4" tokio = { version = "1.40", features = ["time"] } diff --git a/crates/xmedia-bot/Cargo.toml b/crates/xmedia-bot/Cargo.toml index 2b6af2a..2a5fd4f 100644 --- a/crates/xmedia-bot/Cargo.toml +++ b/crates/xmedia-bot/Cargo.toml @@ -14,7 +14,7 @@ dotenv = "0.15" url = "2.5.2" html-escape = "0.2" rusqlite = { version = "0.40", features = ["bundled"] } -rand = "0.8" +rand = "0.10" tempfile = "3" parking_lot = "0.12" bytes = "1" diff --git a/crates/xmedia-bot/src/send/mod.rs b/crates/xmedia-bot/src/send/mod.rs index abafe91..544c1c6 100644 --- a/crates/xmedia-bot/src/send/mod.rs +++ b/crates/xmedia-bot/src/send/mod.rs @@ -17,7 +17,6 @@ use crate::link_cache::{CachedMedia, CachedMediaKind, CachedPost}; use crate::media_sender::MediaSender; use input_media::{build_media_group, input_file_for, item_url}; use post_send::{cache_animation_send, cache_sent_task}; -use rand::Rng; use serde::{Deserialize, Serialize}; use std::sync::LazyLock; use teloxide::prelude::*; @@ -261,7 +260,7 @@ pub fn photos_first(items: Vec) -> Vec { /// Exponential backoff with jitter, capped at 30s. pub fn retry_delay_seconds(attempts: u32) -> f64 { - let jitter: f64 = rand::thread_rng().gen_range(0.2..0.8); + let jitter: f64 = rand::random_range(0.2..0.8); (2f64.powi(attempts as i32) + jitter).min(30.0) }