mirror of
https://github.com/fabianonline/telegram_backup.git
synced 2024-11-23 01:06:17 +00:00
Rewritten FLOOD_WAIT detection code.
This commit is contained in:
parent
d339472ba8
commit
a43b81ee91
@ -70,7 +70,7 @@ public class DownloadManager {
|
|||||||
try {
|
try {
|
||||||
_downloadMessages(limit);
|
_downloadMessages(limit);
|
||||||
} catch (RpcErrorException e) {
|
} catch (RpcErrorException e) {
|
||||||
if (e.getTag().startsWith("420: FLOOD_WAIT_")) {
|
if (e.getCode()==420) { // FLOOD_WAIT
|
||||||
completed = false;
|
completed = false;
|
||||||
Utils.obeyFloodWaitException(e);
|
Utils.obeyFloodWaitException(e);
|
||||||
} else {
|
} else {
|
||||||
|
@ -34,9 +34,9 @@ public class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void obeyFloodWaitException(RpcErrorException e) throws RpcErrorException {
|
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 minutes = (delay/60)+1;
|
||||||
int wait = (minutes / 5) * 5 + 5;
|
int wait = (minutes / 5) * 5 + 5;
|
||||||
System.out.println("");
|
System.out.println("");
|
||||||
|
Loading…
Reference in New Issue
Block a user