mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-12-24 22:15:33 +00:00
Rewritten FLOOD_WAIT detection code.
This commit is contained in:
parent
d339472ba8
commit
a43b81ee91
@ -70,7 +70,7 @@ public class DownloadManager {
|
||||
try {
|
||||
_downloadMessages(limit);
|
||||
} catch (RpcErrorException e) {
|
||||
if (e.getTag().startsWith("420: FLOOD_WAIT_")) {
|
||||
if (e.getCode()==420) { // FLOOD_WAIT
|
||||
completed = false;
|
||||
Utils.obeyFloodWaitException(e);
|
||||
} else {
|
||||
|
@ -34,9 +34,9 @@ public class Utils {
|
||||
}
|
||||
|
||||
static void obeyFloodWaitException(RpcErrorException e) throws RpcErrorException {
|
||||
if (e==null || ! e.getTag().startsWith("420: FLOOD_WAIT_")) return;
|
||||
if (e==null || e.getCode()!=420) return;
|
||||
|
||||
int delay = Integer.parseInt(e.getTag().substring(16));
|
||||
int delay = e.getTagInteger();
|
||||
int minutes = (delay/60)+1;
|
||||
int wait = (minutes / 5) * 5 + 5;
|
||||
System.out.println("");
|
||||
|
Loading…
Reference in New Issue
Block a user