Lonami / grammers

(tele)gramme.rs - use Telegram's API from Rust
https://t.me/gramme_rs
Apache License 2.0
554 stars 113 forks source link

Gap on update #194

Closed gribodyr closed 1 year ago

gribodyr commented 1 year ago

I am using grammers as a userbot. I have an account which is subscribed to a large number of channels/chats.

When I launch my application and enter the update loop, in a short while the log starts to get flooded with the entries like these:

[2023-09-19T18:05:08Z INFO  grammers_session::message_box] gap on update for Channel(1042009118) (local 1742159, count 1, remote 1742174)
[2023-09-19T18:05:08Z INFO  grammers_session::message_box] gap on update for Channel(1110839896) (local 7470860, count 1, remote 7471058)
[2023-09-19T18:05:08Z INFO  grammers_session::message_box] gap on update for Channel(1110839896) (local 7470860, count 1, remote 7471061)
[2023-09-19T18:05:08Z INFO  grammers_session::message_box] gap on update for Channel(1110839896) (local 7470860, count 1, remote 7471063)
[2023-09-19T18:05:08Z INFO  grammers_session::message_box] gap on update for Channel(1042009118) (local 1742159, count 1, remote 1742174)

Thousands of these.

What could be the reason?

Lonami commented 1 year ago

Did you test with the git version and not the one in crates io?

gribodyr commented 1 year ago

Thanks for the tip!

I checked out the repo a few weeks ago, wasn't using the crates.io version. I've just updated my copy and there are quite a few changed files. So I deployed it and am leaving it for a few hours to see if it enters that loop again.

Meanhile, would you mind answering a few questions?

Thank you!

Lonami commented 1 year ago

The library was born as a port of Telethon which has several years on its back. My hope is we will iron the kinks as more people use grammers. Features such as autoreconnect are not yet implemented (but are not bulletproof in Telethon either anyway. Anything dealing with IO should be a service with some restart policy anyway).

Session file contains the update state. If the program dies and you want to fetch missed updates when it goes back up, you should've saved the session prior to the crash.

For questions I would prefer if we used https://t.me/gramme_rs.

gribodyr commented 1 year ago

It's fixed, thank you for the tip and the answers!