mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-23 12:51:16 +00:00
Don't spam the device with retries and gradually increase the sleep time
This commit is contained in:
parent
ad65198f70
commit
e89e579b6c
1 changed files with 3 additions and 3 deletions
|
@ -49,8 +49,8 @@ public class GetTask extends AsyncTask<String, Void, String> {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected String doInBackground(String... params) {
|
protected String doInBackground(String... params) {
|
||||||
// Retry at most 60 times before failing
|
// Retry at most 10 times before failing
|
||||||
for (int i = 0; i < 60; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
String fullUri = params[0] + params[1];
|
String fullUri = params[0] + params[1];
|
||||||
HttpClient httpclient = new DefaultHttpClient();
|
HttpClient httpclient = new DefaultHttpClient();
|
||||||
if (params.length == 5) {
|
if (params.length == 5) {
|
||||||
|
@ -82,7 +82,7 @@ public class GetTask extends AsyncTask<String, Void, String> {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
// Don't push the API too hard
|
// Don't push the API too hard
|
||||||
Thread.sleep(200);
|
Thread.sleep(500 * i);
|
||||||
} catch (InterruptedException e) { }
|
} catch (InterruptedException e) { }
|
||||||
Log.w(TAG, "Retrying GetTask Rest API call ("+i+")");
|
Log.w(TAG, "Retrying GetTask Rest API call ("+i+")");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue