don't log as much when getting scores for SS
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 56s
All checks were successful
Deploy to Dokku / docker (ubuntu-latest) (push) Successful in 56s
This commit is contained in:
parent
ccdeebdc1c
commit
4cc48412f7
@ -104,13 +104,15 @@ public class ScoreSaberService extends TextWebSocketHandler {
|
|||||||
public CachedPage getPageScores(ScoreSaberProfile profile, int page) {
|
public CachedPage getPageScores(ScoreSaberProfile profile, int page) {
|
||||||
String key = profile.getAccountId() + "." + page;
|
String key = profile.getAccountId() + "." + page;
|
||||||
// Check if the page is cached, but don't cache the first page as it's the most likely to change.
|
// Check if the page is cached, but don't cache the first page as it's the most likely to change.
|
||||||
|
CachedPage cachedPage = cachedScorePages.get(key);
|
||||||
if (cachedScorePages.containsKey(key) && page != 1) {
|
if (cachedScorePages.containsKey(key) && page != 1) {
|
||||||
CachedPage cachedPage = cachedScorePages.get(key);
|
|
||||||
cachedPage.setCached(true);
|
cachedPage.setCached(true);
|
||||||
return cachedPage;
|
return cachedPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Fetching scores for account '{}' from page {}.", profile.getAccountId(), page);
|
if (page == 1 || page % 5 == 0 || (cachedPage != null && cachedPage.getPage().getMetadata().getTotal() == page)) {
|
||||||
|
log.info("Fetching scores for account '{}' from page {}.", profile.getAccountId(), page);
|
||||||
|
}
|
||||||
ScoreSaberScoresPageToken pageToken = WebRequest.getAsEntity(String.format(GET_PLAYER_SCORES_ENDPOINT, profile.getAccountId(), "recent", page), ScoreSaberScoresPageToken.class);
|
ScoreSaberScoresPageToken pageToken = WebRequest.getAsEntity(String.format(GET_PLAYER_SCORES_ENDPOINT, profile.getAccountId(), "recent", page), ScoreSaberScoresPageToken.class);
|
||||||
if (pageToken == null) { // Check if the page doesn't exist.
|
if (pageToken == null) { // Check if the page doesn't exist.
|
||||||
return null;
|
return null;
|
||||||
@ -119,7 +121,7 @@ public class ScoreSaberService extends TextWebSocketHandler {
|
|||||||
pageToken.setPlayerScores(Arrays.stream(pageToken.getPlayerScores())
|
pageToken.setPlayerScores(Arrays.stream(pageToken.getPlayerScores())
|
||||||
.sorted((a, b) -> DateUtils.getDateFromString(b.getScore().getTimeSet()).compareTo(DateUtils.getDateFromString(a.getScore().getTimeSet())))
|
.sorted((a, b) -> DateUtils.getDateFromString(b.getScore().getTimeSet()).compareTo(DateUtils.getDateFromString(a.getScore().getTimeSet())))
|
||||||
.toArray(ScoreSaberPlayerScoreToken[]::new));
|
.toArray(ScoreSaberPlayerScoreToken[]::new));
|
||||||
CachedPage cachedPage = new CachedPage(pageToken, false);
|
cachedPage = new CachedPage(pageToken, false);
|
||||||
cachedScorePages.put(key, cachedPage);
|
cachedScorePages.put(key, cachedPage);
|
||||||
return cachedPage;
|
return cachedPage;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user