1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-22 16:56:16 +00:00

Rewritten FLOOD_WAIT detection code.

This commit is contained in:
Fabian Schlenz 2016-07-15 22:22:58 +02:00
parent d339472ba8
commit a43b81ee91
2 changed files with 3 additions and 3 deletions

View File

@ -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 {

View File

@ -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("");