mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-23 01:06:17 +00:00
Removed the extra waiting time when obeying FLOOD_WAIT exceptions.
This commit is contained in:
parent
5b9de9d7cc
commit
4d7e46caa1
@ -49,20 +49,17 @@ public class Utils {
|
|||||||
if (e==null || e.getCode()!=420) return;
|
if (e==null || e.getCode()!=420) return;
|
||||||
|
|
||||||
int delay = e.getTagInteger();
|
int delay = e.getTagInteger();
|
||||||
int minutes = (delay/60)+1;
|
|
||||||
int wait = (minutes / 5) * 5 + 5;
|
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
System.out.println(
|
System.out.println(
|
||||||
"Telegram complained about us (okay, me) making too many requests in too short time by\n" +
|
"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" +
|
"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" +
|
"asked us to wait for " + delay + " seconds.\n" +
|
||||||
"I'm adding a few minutes to let the API recover, so we are going to wait for " + wait + " mins.\n" +
|
|
||||||
"\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" +
|
"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" +
|
"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" +
|
"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.");
|
"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("");
|
System.out.println("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user