Skip to content

Commit

Permalink
Retry posting match status updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Pablete1234 committed Apr 5, 2021
1 parent 35082ec commit b5767d6
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/main/java/rip/bolt/ingame/api/APIManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@ public BoltResponse postPlayerRequeue(UUID uuid) {
}

public BoltMatch postMatch(BoltMatch match) {
return apiService.postMatch(match.getId(), match);
for (int i = 0; i < 10; ) {
try {
return apiService.postMatch(match.getId(), match);
} catch (Exception ex) {
i += 1;

System.out.println(
"Failed to report match end, retrying in " + (i * 5) + "s (" + i + "/10)");
ex.printStackTrace();
try {
Thread.sleep(i * 5000L);
} catch (InterruptedException ignore) {
}
}
}
return null;
}
}

0 comments on commit b5767d6

Please sign in to comment.