mirror of
				https://github.com/fabianonline/telegram_backup.git
				synced 2025-11-04 09:37:46 +00:00 
			
		
		
		
	FLOOD_WAIT-Protection now adds a few minutes of waiting time to give the API time to relax. Also increased the delay between file downloads to 1.5 seconds.
This commit is contained in:
		@@ -36,7 +36,7 @@ class Config {
 | 
				
			|||||||
    public static final int FILE_DOWNLOAD_BLOCK_SIZE = 10*1024*1024;
 | 
					    public static final int FILE_DOWNLOAD_BLOCK_SIZE = 10*1024*1024;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static int DELAY_AFTER_GET_MESSAGES = 200;
 | 
					    public static int DELAY_AFTER_GET_MESSAGES = 200;
 | 
				
			||||||
    public static int DELAY_AFTER_GET_FILE = 750;
 | 
					    public static int DELAY_AFTER_GET_FILE = 1000;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static final String SECRET_GMAPS = "AIzaSyBEtUDhCQKEH6i2Mn1GAiQ9M_tLN0vxHIs";
 | 
					    public static final String SECRET_GMAPS = "AIzaSyBEtUDhCQKEH6i2Mn1GAiQ9M_tLN0vxHIs";
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -172,15 +172,20 @@ class DownloadManager {
 | 
				
			|||||||
					completed = false;
 | 
										completed = false;
 | 
				
			||||||
					Config.DELAY_AFTER_GET_FILE = 1500;
 | 
										Config.DELAY_AFTER_GET_FILE = 1500;
 | 
				
			||||||
					int delay = Integer.parseInt(e.getTag().substring(16));
 | 
										int delay = Integer.parseInt(e.getTag().substring(16));
 | 
				
			||||||
 | 
										int minutes = (delay/60)+1;
 | 
				
			||||||
 | 
										int wait = (minutes / 5) * 5 + 5;
 | 
				
			||||||
					System.out.println("");
 | 
										System.out.println("");
 | 
				
			||||||
					System.out.println("Telegram complained about us (okay, me) making too many requests in too short time.");
 | 
										System.out.println(
 | 
				
			||||||
					System.out.println("So we now have to wait a bit. Telegram asked us to wait for " + delay + " seconds, which");
 | 
											"Telegram complained about us (okay, me) making too many requests in too short time by\n" +
 | 
				
			||||||
					System.out.println("is about " + ((delay / 60) + 1) + " minutes.");
 | 
											"sending us \"" + e.getTag() + "\" as an error. So we now have to wait a bit. Telegram\n" +
 | 
				
			||||||
					System.out.println("So I'm going to do that now. If you don't want to wait, you can quit by pressing");
 | 
											"asked us to wait for " + delay + " seconds, which is about " + minutes + " minutes.\n" +
 | 
				
			||||||
					System.out.println("Ctrl+C. You can restart me at any time and I will just continue to download your");
 | 
											"I'm adding a few minutes to let the API recover, so we are going to wait for " + wait + " mins.\n" +
 | 
				
			||||||
					System.out.println("messages and media. But be advised that just restarting me is not going to change");
 | 
											"\n" +
 | 
				
			||||||
					System.out.println("the fact that Telegram won't talk to me until then.");
 | 
											"So I'm going to do just that for now. If you don't want to wait, you can quit by pressing\n" +
 | 
				
			||||||
					try { Thread.sleep((delay + 60) * 1000); } catch(InterruptedException e2) {}
 | 
											"Ctrl+C. You can restart me at any time and I will just continue to download your\n" +
 | 
				
			||||||
 | 
											"messages and media. But be advised that just restarting me is not going to change\n" +
 | 
				
			||||||
 | 
											"the fact that Telegram won't talk to me until then.");
 | 
				
			||||||
 | 
										try { Thread.sleep(wait * 60 * 1000); } catch(InterruptedException e2) {}
 | 
				
			||||||
					System.out.println("");
 | 
										System.out.println("");
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					throw e;
 | 
										throw e;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user