From 8371344a7d61fd2ce822465108541ad6757c551d Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 9 Aug 2024 00:51:36 +0100 Subject: [PATCH] change account refresh interval --- .../main/java/cc/fascinated/services/UserService.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/API/src/main/java/cc/fascinated/services/UserService.java b/API/src/main/java/cc/fascinated/services/UserService.java index bf53112..3bb9e14 100644 --- a/API/src/main/java/cc/fascinated/services/UserService.java +++ b/API/src/main/java/cc/fascinated/services/UserService.java @@ -28,9 +28,9 @@ import java.util.concurrent.TimeUnit; @Log4j2(topic = "User Service") public class UserService { /** - * The interval to force update the user's account. + * The interval to refresh the user's account data from external services */ - private static long FORCE_UPDATE_INTERVAL = TimeUnit.HOURS.toMillis(4); + private static long ACCOUNT_REFRESH_INTERVAL = TimeUnit.HOURS.toMillis(1); /** * The user repository to use @@ -103,9 +103,9 @@ public class UserService { // Ensure the users ScoreSaber account is up-to-date ScoreSaberAccount scoresaberAccount = user.getScoresaberAccount(); - if (scoresaberAccount == null || scoresaberAccount.getLastUpdated().before(new Date(System.currentTimeMillis() - FORCE_UPDATE_INTERVAL))) { + if (scoresaberAccount == null || scoresaberAccount.getLastUpdated().before(new Date(System.currentTimeMillis() - ACCOUNT_REFRESH_INTERVAL))) { try { - log.info("Updating account for '{}', last update: {}", + log.info("[Scoresaber] Updating account for '{}', last update: {}", steamId, scoresaberAccount == null ? "now" : TimeUtils.format(System.currentTimeMillis() - scoresaberAccount.getLastUpdated().getTime()) ); @@ -118,7 +118,7 @@ public class UserService { historyToday.setCountryRank(accountToken.getCountryRank()); historyToday.setPp(accountToken.getPp()); } catch (Exception ex) { - log.error("Failed to update ScoreSaber account for '{}'", steamId, ex); + log.error("[Scoresaber] Failed to update account for '{}'", steamId, ex); } shouldUpdate = true; }