Skip to content

Conversation

@WaffleLapkin
Copy link
Contributor

Turns out we were wasting a lot of time for no reason while doing graceful shutdown, this PR fixes it. This almost fixes #711 — the shutdown is fast enough that it isn't really frustrating. Sometimes telegram still takes a bit of time to respond to the last get_updates request1, so I think we should still implement the "multiple ^C for forceful shutdown" (additionally it would help for cases when handlers are stuck).

Here is a comparison of new version (this PR/branch) and old one (current master)23:

Peek.2023-09-25.22-05.mp4

Footnotes

  1. I think it happens when last get_updates call and the previous one happen with little delay between them

  2. Note that in second runs of both versions a wait for like 10s or so and the shutdown is much faster for those cases, that's the telegram quirk, I think

  3. I'm so dead by the fact that the new version is so much faster4, like... we could have had this all along 💀 we received so many complaints about the slow shutdown, and it turns out it was almost entirely our fault 💀

  4. the first run is 18s -> 3s (6x times faster), the second one is 10s (11s waiting) -> less than a second (8s waiting) (that's so much faster aaaaa)

@WaffleLapkin WaffleLapkin added S-waiting-on-review Status: Awaiting review from the assignee C-core crate: teloxide-core labels Sep 25, 2023
@hirrolot
Copy link
Member

Nice, will have a look at it ASAP.

@WaffleLapkin
Copy link
Contributor Author

cc @Studiedlist this is semi-related to your work in #894

@hirrolot hirrolot self-requested a review September 29, 2023 19:01
@hirrolot hirrolot added this pull request to the merge queue Sep 29, 2023
Merged via the queue into master with commit d21ca11 Sep 29, 2023
@hirrolot hirrolot deleted the ⚠️polling-in-flight⚠️ branch September 29, 2023 19:10
@WaffleLapkin WaffleLapkin added the A-dispatching Area: dispatching updates (`Dispatcher`, repls) label Jan 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-dispatching Area: dispatching updates (`Dispatcher`, repls) C-core crate: teloxide-core S-waiting-on-review Status: Awaiting review from the assignee

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Graceful shutdown on default settings while developing is frustrating

3 participants