Skip to content

Commit

Permalink
Default to 60 seconds for Retry-After
Browse files Browse the repository at this point in the history
In rare cases where the API has a bug and omits this header, default to 60 seconds so that a later call to `Thread.sleep()` doesn't throw an `IllegalArgumentException`
  • Loading branch information
joetrollo authored Aug 14, 2018
1 parent f1e5b09 commit fb317a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/asana/errors/RateLimitEnforcedError.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public RateLimitEnforcedError(HttpResponseException exception) {
List<String> headers = (List<String>) exception.getHeaders().get("retry-after");
retryAfter = (long) (1000 * Float.parseFloat((String) headers.get(0)));
} catch (Exception e) {
retryAfter = -1;
retryAfter = 60 * 1000;
}
}
}
}

0 comments on commit fb317a6

Please sign in to comment.