Tweaked cache and import users script

This commit is contained in:
nise.moe 2024-03-06 11:41:14 +01:00
parent a70388ac6e
commit 4ddd80bae0
2 changed files with 4 additions and 6 deletions

View File

@ -29,12 +29,11 @@ class GlobalCache(
var statistics: Statistics? = null
var rssFeed: RssFeed? = null
val stopwatch = StopWatch()
// 10 minutes to ms = 600000
@Scheduled(fixedDelay = 600000, initialDelay = 0)
fun updateCaches() {
this.stopwatch.start()
val stopwatch = StopWatch()
stopwatch.start()
logger.info("Updating the cache!")
runBlocking {
@ -49,7 +48,7 @@ class GlobalCache(
suspiciousScores = suspiciousScoresDeferred.await()
}
this.stopwatch.stop()
stopwatch.stop()
logger.info("Cache updated in {} seconds", String.format("%.2f", stopwatch.totalTimeSeconds))
}

View File

@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Profile
import org.springframework.scheduling.annotation.Scheduled
import org.springframework.stereotype.Service
import java.time.LocalDateTime
import java.time.OffsetDateTime
@Service
@ -80,7 +79,7 @@ class ImportUsers(
val bannedUsersCondition = SCORES.IS_BANNED.eq(true)
val usersResult = this.osuApi.getUsersBatch(userIds)
Thread.sleep(SLEEP_AFTER_API_CALL)
Thread.sleep(SLEEP_AFTER_API_CALL * 2)
if (usersResult == null) {
this.logger.error("Failed to get users")