1
0
mirror of https://github.com/fabianonline/telegram_backup.git synced 2024-11-23 01:06:17 +00:00

Tried skipping files in case of a timeout instead of just retrying. Then noticed that the timeout couldn't actually be thrown. Added logging for that case to investigate.

This commit is contained in:
Fabian Schlenz 2017-02-15 08:27:11 +01:00
parent 0b6a771e19
commit 715b86b09b
3 changed files with 11 additions and 2 deletions

View File

@ -36,6 +36,7 @@ class CommandLineDownloadProgress implements DownloadProgressInterface {
System.out.println("'S' - Sticker 'A' - Audio 'G' - Geolocation"); System.out.println("'S' - Sticker 'A' - Audio 'G' - Geolocation");
System.out.println("'.' - Previously downloaded file 'e' - Empty file"); System.out.println("'.' - Previously downloaded file 'e' - Empty file");
System.out.println("' ' - Ignored media type (weblinks or contacts, for example)"); System.out.println("' ' - Ignored media type (weblinks or contacts, for example)");
System.out.println("'x' - File skipped because of timeout errors");
System.out.println("" + count + " Files to check / download"); System.out.println("" + count + " Files to check / download");
} }
@ -47,6 +48,7 @@ class CommandLineDownloadProgress implements DownloadProgressInterface {
public void onMediaAlreadyPresent(AbstractMediaFileManager fm) { public void onMediaAlreadyPresent(AbstractMediaFileManager fm) {
show("."); show(".");
} }
public void onMediaSkipped() { show("x"); }
public void onMediaDownloadFinished() { showNewLine(); System.out.println("Done."); } public void onMediaDownloadFinished() { showNewLine(); System.out.println("Done."); }

View File

@ -239,6 +239,7 @@ public class DownloadManager {
System.out.println(""); System.out.println("");
System.out.println("Telegram took too long to respond to our request."); System.out.println("Telegram took too long to respond to our request.");
System.out.println("I'm going to wait a minute and then try again."); System.out.println("I'm going to wait a minute and then try again.");
logger.warn("TimeoutException caught", e);
try { TimeUnit.MINUTES.sleep(1); } catch(InterruptedException e2) {} try { TimeUnit.MINUTES.sleep(1); } catch(InterruptedException e2) {}
System.out.println(""); System.out.println("");
} }
@ -271,8 +272,13 @@ public class DownloadManager {
} else if (m.isDownloaded()) { } else if (m.isDownloaded()) {
prog.onMediaAlreadyPresent(m); prog.onMediaAlreadyPresent(m);
} else { } else {
/*try {*/
m.download(); m.download();
prog.onMediaDownloaded(m); prog.onMediaDownloaded(m);
/*} catch (TimeoutException e) {
// do nothing - skip this file
prog.onMediaSkipped();
}*/
} }
} }
prog.onMediaDownloadFinished(); prog.onMediaDownloadFinished();

View File

@ -26,6 +26,7 @@ public interface DownloadProgressInterface {
public void onMediaDownloadStart(int count); public void onMediaDownloadStart(int count);
public void onMediaDownloaded(AbstractMediaFileManager a); public void onMediaDownloaded(AbstractMediaFileManager a);
public void onMediaDownloadedEmpty(); public void onMediaDownloadedEmpty();
public void onMediaSkipped();
public void onMediaAlreadyPresent(AbstractMediaFileManager a); public void onMediaAlreadyPresent(AbstractMediaFileManager a);
public void onMediaDownloadFinished(); public void onMediaDownloadFinished();
} }