Update the dependencies

This commit is contained in:
Temirkhan Myrzamadi 2021-02-22 08:14:33 +06:00
parent fe6429c279
commit f33428be03
7 changed files with 42 additions and 33 deletions

View file

@ -36,43 +36,46 @@ macros = ["teloxide-macros"]
nightly = [] # currently used for `README.md` tests and building docs for `docsrs` to add `This is supported on feature="..." only.` nightly = [] # currently used for `README.md` tests and building docs for `docsrs` to add `This is supported on feature="..." only.`
[dependencies] [dependencies]
serde_json = "1.0.55" teloxide-core = "0.1"
serde = { version = "1.0.114", features = ["derive"] }
tokio = { version = "0.2.21", features = ["fs", "stream"] } serde_json = "1.0"
tokio-util = "0.3.1" serde = { version = "1.0", features = ["derive"] }
reqwest = { version = "0.10.6", features = ["json", "stream"] } tokio = { version = "1.2", features = ["fs"] }
log = "0.4.8" tokio-util = "0.6"
tokio-stream = "0.1"
reqwest = { version = "0.11", features = ["json", "stream"] }
log = "0.4"
lockfree = "0.5.1" lockfree = "0.5.1"
bytes = "0.5.5" bytes = "1.0"
mime = "0.3.16" mime = "0.3"
derive_more = "0.99.9" derive_more = "0.99"
thiserror = "1.0.20" thiserror = "1.0"
async-trait = "0.1.36" async-trait = "0.1"
futures = "0.3.5" futures = "0.3"
pin-project = "0.4.22" pin-project = "1.0"
serde_with_macros = "1.1.0" serde_with_macros = "1.4"
sqlx = { version = "0.4.0-beta.1", optional = true, default-features = false, features = [ sqlx = { version = "0.5", optional = true, default-features = false, features = [
"runtime-tokio-native-tls", "runtime-tokio-native-tls",
"macros", "macros",
"sqlite", "sqlite",
] } ] }
redis = { version = "0.16.0", optional = true } redis = { version = "0.16", optional = true }
serde_cbor = { version = "0.11.1", optional = true } serde_cbor = { version = "0.11", optional = true }
bincode = { version = "1.3.1", optional = true } bincode = { version = "1.3", optional = true }
frunk = { version = "0.3.1", optional = true } frunk = { version = "0.3", optional = true }
teloxide-macros = { git = "https://github.com/teloxide/teloxide-macros", branch = "master", optional = true } teloxide-macros = { git = "https://github.com/teloxide/teloxide-macros", branch = "master", optional = true }
[dev-dependencies] [dev-dependencies]
smart-default = "0.6.0" smart-default = "0.6.0"
rand = "0.7.3" rand = "0.8.3"
pretty_env_logger = "0.4.0" pretty_env_logger = "0.4.0"
lazy_static = "1.4.0" lazy_static = "1.4.0"
tokio = { version = "0.2.21", features = ["fs", "stream", "rt-threaded", "macros"] } tokio = { version = "1.2.0", features = ["fs", "rt", "macros"] }
[package.metadata.docs.rs] [package.metadata.docs.rs]
all-features = true all-features = true

View file

@ -1,6 +1,6 @@
format_code_in_doc_comments = true format_code_in_doc_comments = true
wrap_comments = true wrap_comments = true
format_strings = true format_strings = true
merge_imports = true imports_granularity = "Crate"
use_small_heuristics = "Max" use_small_heuristics = "Max"
use_field_init_shorthand = true use_field_init_shorthand = true

View file

@ -126,7 +126,7 @@ pub(crate) fn sound_bot() -> ClientBuilder {
ClientBuilder::new() ClientBuilder::new()
.connect_timeout(connect_timeout) .connect_timeout(connect_timeout)
.timeout(Duration::from_secs(connect_timeout.as_secs() + timeout + 2)) .timeout(Duration::from_secs(connect_timeout.as_secs() + timeout + 2))
.tcp_nodelay_(true) .tcp_nodelay(true)
.default_headers(headers) .default_headers(headers)
} }

View file

@ -11,6 +11,7 @@ use tokio::sync::mpsc;
use lockfree::map::Map; use lockfree::map::Map;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use tokio_stream::wrappers::UnboundedReceiverStream;
/// A dispatcher of dialogues. /// A dispatcher of dialogues.
/// ///
@ -84,7 +85,7 @@ where
let handler = Arc::clone(&self.handler); let handler = Arc::clone(&self.handler);
let senders = Arc::clone(&self.senders); let senders = Arc::clone(&self.senders);
tokio::spawn(rx.for_each(move |cx: UpdateWithCx<Upd>| { tokio::spawn(UnboundedReceiverStream::new(rx).for_each(move |cx: UpdateWithCx<Upd>| {
let storage = Arc::clone(&storage); let storage = Arc::clone(&storage);
let handler = Arc::clone(&handler); let handler = Arc::clone(&handler);
let senders = Arc::clone(&senders); let senders = Arc::clone(&senders);
@ -137,7 +138,7 @@ where
{ {
let this = Arc::new(self); let this = Arc::new(self);
updates UnboundedReceiverStream::new(updates)
.for_each(move |cx| { .for_each(move |cx| {
let this = Arc::clone(&this); let this = Arc::clone(&this);
let chat_id = cx.update.chat_id(); let chat_id = cx.update.chat_id();

View file

@ -10,6 +10,7 @@ use crate::{
}; };
use futures::StreamExt; use futures::StreamExt;
use std::{fmt::Debug, future::Future, sync::Arc}; use std::{fmt::Debug, future::Future, sync::Arc};
use tokio_stream::wrappers::UnboundedReceiverStream;
/// A [REPL] for commands. /// A [REPL] for commands.
/// ///
@ -73,13 +74,16 @@ pub async fn commands_repl_with_listener<'a, Cmd, H, Fut, L, ListenerE, HandlerE
Dispatcher::new(bot) Dispatcher::new(bot)
.messages_handler(move |rx: DispatcherHandlerRx<Message>| { .messages_handler(move |rx: DispatcherHandlerRx<Message>| {
rx.commands::<Cmd, N>(bot_name).for_each_concurrent(None, move |(cx, cmd)| { UnboundedReceiverStream::new(rx).commands::<Cmd, N>(bot_name).for_each_concurrent(
None,
move |(cx, cmd)| {
let handler = Arc::clone(&handler); let handler = Arc::clone(&handler);
async move { async move {
handler(cx, cmd).await.log_on_error().await; handler(cx, cmd).await.log_on_error().await;
} }
}) },
)
}) })
.dispatch_with_listener( .dispatch_with_listener(
listener, listener,

View file

@ -9,6 +9,7 @@ use crate::{
}; };
use futures::StreamExt; use futures::StreamExt;
use std::{fmt::Debug, future::Future, sync::Arc}; use std::{fmt::Debug, future::Future, sync::Arc};
use tokio_stream::wrappers::UnboundedReceiverStream;
/// A [REPL] for messages. /// A [REPL] for messages.
/// ///
@ -57,7 +58,7 @@ where
Dispatcher::new(bot) Dispatcher::new(bot)
.messages_handler(|rx: DispatcherHandlerRx<Message>| { .messages_handler(|rx: DispatcherHandlerRx<Message>| {
rx.for_each_concurrent(None, move |message| { UnboundedReceiverStream::new(rx).for_each_concurrent(None, move |message| {
let handler = Arc::clone(&handler); let handler = Arc::clone(&handler);
async move { async move {

View file

@ -52,7 +52,7 @@ where
T: DeserializeOwned, T: DeserializeOwned,
{ {
if response.status().is_server_error() { if response.status().is_server_error() {
tokio::time::delay_for(DELAY_ON_SERVER_ERROR).await; tokio::time::sleep(DELAY_ON_SERVER_ERROR).await;
} }
serde_json::from_str::<TelegramResponse<T>>( serde_json::from_str::<TelegramResponse<T>>(