oh? x.x
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 35s

This commit is contained in:
Lee 2024-08-01 01:16:07 +01:00
parent 900ccba67e
commit 3f5eff3d1a

@ -188,10 +188,10 @@ public class ScoreSaberPlatform extends Platform {
@Override
public void updateLeaderboards() {
List<TrackedScore> scores = this.trackedScoreService.getTrackedScores(this.getPlatform(), false);
List<String> leaderboardIds = scores.stream().map(TrackedScore::getLeaderboardId).toList();
List<String> uniqueLeaderboardIds = scores.stream().map(TrackedScore::getLeaderboardId).distinct().toList();
log.info("Updating {} leaderboards for platform '{}'",
leaderboardIds.size(),
uniqueLeaderboardIds.size(),
this.getPlatform().getPlatformName()
);
@ -211,7 +211,7 @@ public class ScoreSaberPlatform extends Platform {
}
// Update the leaderboards
for (String id : leaderboardIds) {
for (String id : uniqueLeaderboardIds) {
try {
ScoreSaberLeaderboardToken leaderboard = this.scoreSaberService.getLeaderboard(id, true); // Update the cached leaderboard
if (leaderboard == null) {
@ -251,14 +251,14 @@ public class ScoreSaberPlatform extends Platform {
this.getPlatform().getPlatformName(),
toUpdate.size(),
finished,
leaderboardIds.size()
uniqueLeaderboardIds.size()
);
// Sleep to prevent rate limiting
try {
Thread.sleep(UPDATE_DELAY);
} catch (InterruptedException e) {
e.printStackTrace();
log.error("Failed to sleep for rate limit reset", e);
}
} catch (Exception ex) {
log.error("An error occurred while updating leaderboard '{}'", id, ex);