From 43b1f8445a8dbfed1a6fe9c8b5a3575d79ff2292 Mon Sep 17 00:00:00 2001 From: Waffle Maybe Date: Sat, 2 Mar 2024 21:30:13 +0100 Subject: [PATCH 1/3] improve `ApiError::TerminatedByOtherGetUpdates` docs --- crates/teloxide-core/src/errors.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/crates/teloxide-core/src/errors.rs b/crates/teloxide-core/src/errors.rs index 08d140e8..50bc6930 100644 --- a/crates/teloxide-core/src/errors.rs +++ b/crates/teloxide-core/src/errors.rs @@ -677,13 +677,19 @@ impl_api_error! { /// [`SendMessage`]: crate::payloads::SendMessage WrongHttpUrl = "Bad Request: wrong HTTP URL", - /// Occurs when bot tries GetUpdate before the timeout. Make sure that only - /// one Updater is running. + /// Occurs when multiple [`GetUpdates`] calls happen at the same time. + /// + /// This can happen if + /// 1. You are running multiple bot instances + /// 2. You are running multiple update consumers (like [`Dispatcher`] or [`repl`]) + /// 3. You are calling [`GetUpdates`] yourself and the second call is done before the first one finishes /// /// May happen in methods: /// 1. [`GetUpdates`] /// /// [`GetUpdates`]: crate::payloads::GetUpdates + /// [`Dispatcher`]: crate::dispatching::Dispatcher + /// [`repl`]: crate::repl TerminatedByOtherGetUpdates = "Conflict: terminated by other getUpdates request; make sure that only one bot instance \ is running", From 887f74de4045b5a0967c116236be21b983d9293c Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sat, 23 Mar 2024 17:22:41 +0100 Subject: [PATCH 2/3] Remove broken links That's awkward: you can't mention items from teloxide in teloxide-core --- crates/teloxide-core/src/errors.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/teloxide-core/src/errors.rs b/crates/teloxide-core/src/errors.rs index 50bc6930..8ba048dd 100644 --- a/crates/teloxide-core/src/errors.rs +++ b/crates/teloxide-core/src/errors.rs @@ -681,15 +681,13 @@ impl_api_error! { /// /// This can happen if /// 1. You are running multiple bot instances - /// 2. You are running multiple update consumers (like [`Dispatcher`] or [`repl`]) + /// 2. You are running multiple update consumers (like `Dispatcher` or `repl`) /// 3. You are calling [`GetUpdates`] yourself and the second call is done before the first one finishes /// /// May happen in methods: /// 1. [`GetUpdates`] /// /// [`GetUpdates`]: crate::payloads::GetUpdates - /// [`Dispatcher`]: crate::dispatching::Dispatcher - /// [`repl`]: crate::repl TerminatedByOtherGetUpdates = "Conflict: terminated by other getUpdates request; make sure that only one bot instance \ is running", From 61ae468bf71bf684643ced69167fb0de100d155a Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Sat, 23 Mar 2024 17:55:11 +0100 Subject: [PATCH 3/3] Random re-fmt?... --- crates/teloxide/src/update_listeners.rs | 2 +- crates/teloxide/src/update_listeners/polling.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/teloxide/src/update_listeners.rs b/crates/teloxide/src/update_listeners.rs index 34f8a0de..e3def4e8 100644 --- a/crates/teloxide/src/update_listeners.rs +++ b/crates/teloxide/src/update_listeners.rs @@ -63,7 +63,7 @@ pub trait UpdateListener: type Err; /// Returns a token which stops this listener. - /// + /// /// The [`stop`] function of the token is not guaranteed to have an /// immediate effect. That is, some listeners can return updates even /// after [`stop`] is called (e.g.: because of buffering). diff --git a/crates/teloxide/src/update_listeners/polling.rs b/crates/teloxide/src/update_listeners/polling.rs index cf3cb4fd..3858a57f 100644 --- a/crates/teloxide/src/update_listeners/polling.rs +++ b/crates/teloxide/src/update_listeners/polling.rs @@ -195,20 +195,20 @@ where /// telegram. /// /// ```mermaid -/// sequenceDiagram +/// sequenceDiagram /// participant C as Consumer /// participant P as Polling /// participant T as Telegram /// /// link C: Dispatcher @ ../struct.Dispatcher.html /// link C: repl @ ../../fn.repl.html -/// +/// /// C->>P: next /// /// P->>+T: Updates? (offset = 0) /// Note right of T: timeout /// T->>-P: None -/// +/// /// P->>+T: Updates? (offset = 0) /// Note right of T: <= timeout /// T->>-P: updates with ids [3, 4] @@ -217,10 +217,10 @@ where /// /// C->>P: next /// P->>C: update(4) -/// +/// /// C->>P: next /// -/// P->>+T: Updates? (offset = 5) +/// P->>+T: Updates? (offset = 5) /// Note right of T: <= timeout /// T->>-P: updates with ids [5] ///