From 8ad1bd1928728bd1a7d9888f337031c493615a46 Mon Sep 17 00:00:00 2001 From: Ilya Bizyaev Date: Sun, 14 Jul 2024 18:42:30 +0200 Subject: [PATCH] Bump deps of webhook-axum Otherwise some changes in axum's Router interface prevent teloxide's webhook support from being used with up-to-date axum. --- crates/teloxide/Cargo.toml | 6 +++--- crates/teloxide/src/update_listeners/webhooks/axum.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/teloxide/Cargo.toml b/crates/teloxide/Cargo.toml index ef204d2c..48116b65 100644 --- a/crates/teloxide/Cargo.toml +++ b/crates/teloxide/Cargo.toml @@ -112,9 +112,9 @@ sqlx = { version = "0.7.3", optional = true, default-features = false, features redis = { version = "0.24", features = ["tokio-comp"], optional = true } serde_cbor = { version = "0.11", optional = true } bincode = { version = "1.3", optional = true } -axum = { version = "0.6.0", optional = true } -tower = { version = "0.4.12", optional = true } -tower-http = { version = "0.3.4", features = ["trace"], optional = true } +axum = { version = "0.7.0", optional = true } +tower = { version = "0.4.13", optional = true } +tower-http = { version = "0.5.2", features = ["trace"], optional = true } rand = { version = "0.8.5", optional = true } # HACK: ahash 0.8.7 bumped MSRV to 1.72, to keep MVSR 1.68 we need to depend on an older version. diff --git a/crates/teloxide/src/update_listeners/webhooks/axum.rs b/crates/teloxide/src/update_listeners/webhooks/axum.rs index 2a915a55..9cd019af 100644 --- a/crates/teloxide/src/update_listeners/webhooks/axum.rs +++ b/crates/teloxide/src/update_listeners/webhooks/axum.rs @@ -47,13 +47,13 @@ where ::DeleteWebhook: Send, { let Options { address, .. } = options; + let tcp_listener = tokio::net::TcpListener::bind(address).await.unwrap(); let (mut update_listener, stop_flag, app) = axum_to_router(bot, options).await?; let stop_token = update_listener.stop_token(); tokio::spawn(async move { - axum::Server::bind(&address) - .serve(app.into_make_service()) + axum::serve(tcp_listener, app) .with_graceful_shutdown(stop_flag) .await .map_err(|err| { @@ -90,7 +90,7 @@ where /// [`delete_webhook`]: crate::payloads::DeleteWebhook /// [`stop`]: crate::stop::StopToken::stop /// [`options.address`]: Options::address -/// [`with_graceful_shutdown`]: axum::Server::with_graceful_shutdown +/// [`with_graceful_shutdown`]: axum::serve::Serve::with_graceful_shutdown /// /// ## Returns ///