3bl3gamer / tg_history_dumper

Exports messages and media from Telegram dialogs, groups and channels
MIT License
69 stars 13 forks source link

Doesn't wait for chat list to load #22

Open yavor-sky opened 11 months ago

yavor-sky commented 11 months ago

Greetings!

If there are a lot of chats and chats from approximately 2018-2020, then the Telegram servers take a long time to load them. The official client on the phone froze briefly for the first time, but then loaded the list of chats. And in this project, it tries to load a list of chats, gets an error and tries to download it again, rather than wait for the remaining list.

2023/12/10 01:43:12 [WARN] some chats seem missing: got 149 in the end, expected 289; retrying from start
2023/12/10 01:43:12 [WARN] some chats seem missing: got 298 in the end, expected 289; retrying from start
2023/12/10 01:43:12 [WARN] some chats seem missing: got 447 in the end, expected 289; retrying from start
2023/12/10 01:43:12 [WARN] some chats seem missing: got 596 in the end, expected 289; retrying from start
2023/12/10 01:43:13 [WARN] some chats seem missing: got 745 in the end, expected 289; retrying from start
2023/12/10 01:43:13 [WARN] some chats seem missing: got 894 in the end, expected 289; retrying from start
2023/12/10 01:43:13 [WARN] some chats seem missing: got 1043 in the end, expected 289; retrying from start
2023/12/10 01:43:14 [WARN] some chats seem missing: got 1192 in the end, expected 289; retrying from start
2023/12/10 01:43:14 [WARN] some chats seem missing: got 1341 in the end, expected 289; retrying from start
2023/12/10 01:43:14 [WARN] some chats seem missing: got 1490 in the end, expected 289; retrying from start
2023/12/10 01:43:14 [WARN] got flood-wait, retrying in 28s, retry #0 of 0 short
pmurzakov commented 10 months ago

The most likely reason for this is pinned chats. As a workaround you can unpin all of them and dump again.

pmurzakov commented 10 months ago

Also you can try this PR which should fix the issue https://github.com/3bl3gamer/tg_history_dumper/pull/26

yavor-sky commented 9 months ago

The problem is not in pinned chat. This occurs one step earlier, at the time of receiving the list of all chats. Very old chats, in which the last action was 3-4 years ago, do not load immediately, !!!even the official client freezes when loading the list of chats.

And the dumper tries to load the chat list, does not receive the entire list and breaks off. As it is written in the log, he expected 289 chats, but received 149. Then it starts loading the list of chats again from the beginning and receives the first 149 and sums them up, and so on ad infinitum (the "got" counter increases by 149).

I deleted old chats and the "got" counter always grew by the same value.

3bl3gamer commented 5 months ago

Sorry for the delay.

Chat loading logic is now rewritten and though I'm not sure exactly how the dumper has ended up with less chats than expected, it currently should not loop in this case. It will try to re-download chat list one more time, print the error and try to continue with incomplete list.

I've also fixed some bugs in list loading, that could theoretically affect you (though the chances are slim).

There are also a bit more logs in the list loading now (including debug ones, see -debug flag).