Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
iced committed Mar 21, 2012
1 parent 2dfd83c commit a8df94c
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions client/src/main/java/io/iron/ironworker/client/APIClient.java
Expand Up @@ -127,21 +127,19 @@ private HttpResponse doRequestExecute(HttpRequestBase request) throws APIExcepti
if (response.getStatusLine().getStatusCode() != 503) { if (response.getStatusLine().getStatusCode() != 503) {
return response; return response;
} }

try {
Thread.sleep((long)(Math.pow(4, currentTry) * 100 * Math.random()));
} catch (InterruptedException e) {
if (currentTry == maxRetries - 1) {
throw new APIException(null, e);
}
}
} catch (IOException e) { } catch (IOException e) {
if (currentTry == maxRetries - 1) { if (currentTry == maxRetries - 1) {
throw new APIException(null, e); throw new APIException(null, e);
} }
} }


currentTry += 1; try {
Thread.sleep((long)(Math.pow(4, currentTry) * 100 * Math.random()));
} catch (InterruptedException e) {
throw new APIException(null, e);
}

currentTry++;
} }


return response; return response;
Expand Down

0 comments on commit a8df94c

Please sign in to comment.