fabianonline / telegram_backup

Java app to download all your telegram data.
GNU General Public License v3.0
447 stars 91 forks source link

Properly handle FLOOD_WAIT in media download phase #87

Closed leijurv closed 6 years ago

leijurv commented 6 years ago

Tested and fixes issue #84

Screenshot from that issue: 2018-01-31 12 58 57

leijurv commented 6 years ago

Example output with this fix:

   .. . ..    ........ ...   ....  ..... ..... ... ..  . .. . ...       ...     ... .......... . . . - 121300/121491
 ................................   .. .  . .......................... ... .........  ...    ... ... - 121400/121491
...........  ...............  ........................... . ... .... .. ..10:48:33.077 DEBUG DownloadManager.downloadFileFromDc : Downloading file /mnt/tgdata//+1REDACTEDXX/files/956292.mp4
10:48:33.077 INFO  DownloadManager.downloadFileFromDc : Temporary filename already exists; continuing this file

Telegram complained about us (okay, me) making too many requests in too short time by
sending us "FLOOD_WAIT_3" as an error. So we now have to wait a bit. Telegram
asked us to wait for 3 seconds.

So I'm going to do just that for now. If you don't want to wait, you can quit by pressing
Ctrl+C. You can restart me at any time and I will just continue to download your
messages and media. But be advised that just restarting me is not going to change
the fact that Telegram won't talk to me until then.

D10:48:39.092 DEBUG DownloadManager.downloadFileFromDc : Downloading file /mnt/tgdata//+1REDACTEDXX/files/956332.txt
D10:48:39.567 DEBUG DownloadManager.downloadFileFromDc : Downloading file /mnt/tgdata//+1REDACTEDXX/files/956333.txt
D10:48:39.781 DEBUG DownloadManager.downloadFileFromDc : Downloading file /mnt/tgdata//+1REDACTEDXX/files/956427.jpg
P10:48:40.160 DEBUG DownloadManager.downloadFileFromDc : Downloading file /mnt/tgdata//+1REDACTEDXX/files/956454.jpg

It continues on to download the next few media files instead of exiting due to the exception.