From bdad804eede4f3cd46dbcf5ba820a4ec2ffdf3c9 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 2 Aug 2024 19:28:30 +0100 Subject: [PATCH] api: oopsie doodle --- .../cc/fascinated/services/UserService.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/API/src/main/java/cc/fascinated/services/UserService.java b/API/src/main/java/cc/fascinated/services/UserService.java index 809271b..87fafed 100644 --- a/API/src/main/java/cc/fascinated/services/UserService.java +++ b/API/src/main/java/cc/fascinated/services/UserService.java @@ -72,13 +72,17 @@ 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))) { - log.info("Updating account for '{}', last update: {}", - steamId, - scoresaberAccount == null ? "now" : TimeUtils.format(System.currentTimeMillis() - scoresaberAccount.getLastUpdated().getTime()) - ); - ScoreSaberAccountToken accountToken = scoreSaberService.getAccount(user); - user.setScoresaberAccount(ScoreSaberAccount.getFromToken(accountToken)); // Update the ScoreSaber account - user.setUsername(accountToken.getName()); // Update the username + try { + log.info("Updating account for '{}', last update: {}", + steamId, + scoresaberAccount == null ? "now" : TimeUtils.format(System.currentTimeMillis() - scoresaberAccount.getLastUpdated().getTime()) + ); + ScoreSaberAccountToken accountToken = scoreSaberService.getAccount(user); + user.setScoresaberAccount(ScoreSaberAccount.getFromToken(accountToken)); // Update the ScoreSaber account + user.setUsername(accountToken.getName()); // Update the username + } catch (Exception ex) { + log.error("Failed to update ScoreSaber account for '{}'", steamId, ex); + } shouldUpdate = true; } if (shouldUpdate) {