1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-12-26 06:45:33 +00:00

Removed the extra waiting time when obeying FLOOD_WAIT exceptions.

This commit is contained in:
Fabian Schlenz 2016-09-15 06:37:42 +02:00
parent 5b9de9d7cc
commit 4d7e46caa1

View File

@ -49,20 +49,17 @@ public class Utils {
if (e==null || e.getCode()!=420) return;
int delay = e.getTagInteger();
int minutes = (delay/60)+1;
int wait = (minutes / 5) * 5 + 5;
System.out.println("");
System.out.println(
"Telegram complained about us (okay, me) making too many requests in too short time by\n" +
"sending us \"" + e.getTag() + "\" as an error. So we now have to wait a bit. Telegram\n" +
"asked us to wait for " + delay + " seconds, which is about " + minutes + " minutes.\n" +
"I'm adding a few minutes to let the API recover, so we are going to wait for " + wait + " mins.\n" +
"asked us to wait for " + delay + " seconds.\n" +
"\n" +
"So I'm going to do just that for now. If you don't want to wait, you can quit by pressing\n" +
"Ctrl+C. You can restart me at any time and I will just continue to download your\n" +
"messages and media. But be advised that just restarting me is not going to change\n" +
"the fact that Telegram won't talk to me until then.");
try { Thread.sleep(wait * 60 * 1000); } catch(InterruptedException e2) {}
try { Thread.sleep((delay + 1) * 1000); } catch(InterruptedException e2) {}
System.out.println("");
}