Skip to content

Commit

Permalink
releaseb retry on 500 code too
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammers21 committed Aug 24, 2023
1 parent 338d8a9 commit aeeab68
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/io/github/sammers/pla/blizzard/BlizzardAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,9 @@ Maybe<JsonObject> maybeResponse(String namespace, String url) {
.flatMapMaybe(resp -> {
if (resp.statusCode() == 200) {
return Maybe.just(resp.bodyAsJsonObject());
} else if (resp.statusCode() == 429){
log.info("429 Retrying " + url + " " + resp.statusMessage());
} else if (resp.statusCode() == 429 || resp.statusCode() == 500) {
int code = resp.statusCode();
log.info(code + " Retrying " + url + " " + resp.statusMessage());
return rpsToken().andThen(rpsToken()).andThen(maybeResponse(namespace, url));
} else {
return Maybe.error(new IllegalStateException("Error getting " + url + " " + resp.statusCode() + " " + resp.statusMessage() + " " + resp.bodyAsString()));
Expand Down

0 comments on commit aeeab68

Please sign in to comment.