From bef2b695f585fd5b54bee07822bee91f9c1f25ab Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 5 Jul 2024 19:49:16 +0100 Subject: [PATCH] remove some debug and fix depends on for scoresaber service --- src/main/java/cc/fascinated/bat/service/ScoreSaberService.java | 2 ++ src/main/java/cc/fascinated/bat/service/SpotifyService.java | 2 ++ src/main/java/cc/fascinated/bat/service/UserService.java | 3 --- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/cc/fascinated/bat/service/ScoreSaberService.java b/src/main/java/cc/fascinated/bat/service/ScoreSaberService.java index c9b2b92..d8e2037 100644 --- a/src/main/java/cc/fascinated/bat/service/ScoreSaberService.java +++ b/src/main/java/cc/fascinated/bat/service/ScoreSaberService.java @@ -14,6 +14,7 @@ import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; import net.jodah.expiringmap.ExpiringMap; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.DependsOn; import org.springframework.stereotype.Service; import org.springframework.web.socket.CloseStatus; import org.springframework.web.socket.TextMessage; @@ -29,6 +30,7 @@ import java.util.concurrent.TimeUnit; @Service @Log4j2(topic = "ScoreSaber Service") +@DependsOn("discordService") public class ScoreSaberService extends TextWebSocketHandler { private static final String SCORESABER_API = "https://scoresaber.com/api/"; private static final String GET_PLAYER_ENDPOINT = SCORESABER_API + "player/%s/full"; diff --git a/src/main/java/cc/fascinated/bat/service/SpotifyService.java b/src/main/java/cc/fascinated/bat/service/SpotifyService.java index 4feb680..f0d2431 100644 --- a/src/main/java/cc/fascinated/bat/service/SpotifyService.java +++ b/src/main/java/cc/fascinated/bat/service/SpotifyService.java @@ -10,6 +10,7 @@ import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; import net.jodah.expiringmap.ExpiringMap; import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.DependsOn; import org.springframework.stereotype.Service; import se.michaelthelin.spotify.SpotifyApi; import se.michaelthelin.spotify.enums.AuthorizationScope; @@ -27,6 +28,7 @@ import java.util.concurrent.TimeUnit; @Service @Getter @Log4j2(topic = "Spotify Service") +@DependsOn("discordService") public class SpotifyService { /** * The access token map. diff --git a/src/main/java/cc/fascinated/bat/service/UserService.java b/src/main/java/cc/fascinated/bat/service/UserService.java index cde7cb0..b3ad11b 100644 --- a/src/main/java/cc/fascinated/bat/service/UserService.java +++ b/src/main/java/cc/fascinated/bat/service/UserService.java @@ -63,7 +63,6 @@ public class UserService implements EventListener { if (document != null) { BatUser batUser = new BatUser(id, user, document); users.put(id, batUser); -// log.info("Loaded user \"{}\" in {}ms", batUser.getName(),System.currentTimeMillis() - before); return batUser; } // New user @@ -82,11 +81,9 @@ public class UserService implements EventListener { public BatUser getUser(@NonNull String id) { User user = DiscordService.JDA.getUserById(id); if (user == null) { - log.warn("Attempted to get user with ID \"{}\" but they do not exist", id); return null; } if (user.isBot()) { - log.warn("Attempted to get user with ID \"{}\" but they are a bot", id); return null; } return getUser(id, null);