mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-26 22:31:16 +00:00
Merge branch 'Zillode-fix-npe-jsontokener'
This commit is contained in:
commit
24ba984ec5
1 changed files with 35 additions and 27 deletions
|
@ -49,6 +49,8 @@ public class GetTask extends AsyncTask<String, Void, String> {
|
|||
*/
|
||||
@Override
|
||||
protected String doInBackground(String... params) {
|
||||
// Retry at most 10 times before failing
|
||||
for (int i = 0; i < 10; i++) {
|
||||
String fullUri = params[0] + params[1];
|
||||
HttpClient httpclient = new DefaultHttpClient();
|
||||
if (params.length == 5) {
|
||||
|
@ -78,6 +80,12 @@ public class GetTask extends AsyncTask<String, Void, String> {
|
|||
} catch (IOException e) {
|
||||
Log.w(TAG, "Failed to call Rest API at " + fullUri, e);
|
||||
}
|
||||
try {
|
||||
// Don't push the API too hard
|
||||
Thread.sleep(100);
|
||||
} catch (InterruptedException e) { }
|
||||
Log.w(TAG, "Retrying GetTask Rest API call ("+i+")");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue