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

View File

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