diff --git a/src/dispatching/update_listeners.rs b/src/dispatching/update_listeners.rs index 840ea90a..66c72b67 100644 --- a/src/dispatching/update_listeners.rs +++ b/src/dispatching/update_listeners.rs @@ -120,11 +120,11 @@ pub trait UpdateListener: Stream> { } impl UpdateListener for S where S: Stream> {} -/// Returns a long polling update listener with `timeout` of 1 minute. +/// Returns a long polling update listener with `timeout` of 10 seconds. /// /// See also: [`polling`](polling). pub fn polling_default(bot: Arc) -> impl UpdateListener { - polling(bot, Some(Duration::from_secs(60)), None, None) + polling(bot, Some(Duration::from_secs(10)), None, None) } /// Returns a long/short polling update listener with some additional options. diff --git a/src/net/request.rs b/src/net/request.rs index 9f8d7069..171f923e 100644 --- a/src/net/request.rs +++ b/src/net/request.rs @@ -4,6 +4,7 @@ use serde::{de::DeserializeOwned, Serialize}; use crate::{requests::ResponseResult, RequestError}; use super::{TelegramResponse, TELEGRAM_API_URL}; +use reqwest::header::CONNECTION; pub async fn request_multipart( client: &Client, @@ -16,6 +17,7 @@ where { let response = client .post(&super::method_url(TELEGRAM_API_URL, token, method_name)) + .header(CONNECTION, "keep-alive") .multipart(params) .send() .await @@ -36,6 +38,7 @@ where { let response = client .post(&super::method_url(TELEGRAM_API_URL, token, method_name)) + .header(CONNECTION, "keep-alive") .json(params) .send() .await