Tweaked cache and import users script
This commit is contained in:
parent
a70388ac6e
commit
4ddd80bae0
@ -29,12 +29,11 @@ class GlobalCache(
|
|||||||
var statistics: Statistics? = null
|
var statistics: Statistics? = null
|
||||||
var rssFeed: RssFeed? = null
|
var rssFeed: RssFeed? = null
|
||||||
|
|
||||||
val stopwatch = StopWatch()
|
|
||||||
|
|
||||||
// 10 minutes to ms = 600000
|
// 10 minutes to ms = 600000
|
||||||
@Scheduled(fixedDelay = 600000, initialDelay = 0)
|
@Scheduled(fixedDelay = 600000, initialDelay = 0)
|
||||||
fun updateCaches() {
|
fun updateCaches() {
|
||||||
this.stopwatch.start()
|
val stopwatch = StopWatch()
|
||||||
|
stopwatch.start()
|
||||||
logger.info("Updating the cache!")
|
logger.info("Updating the cache!")
|
||||||
|
|
||||||
runBlocking {
|
runBlocking {
|
||||||
@ -49,7 +48,7 @@ class GlobalCache(
|
|||||||
suspiciousScores = suspiciousScoresDeferred.await()
|
suspiciousScores = suspiciousScoresDeferred.await()
|
||||||
}
|
}
|
||||||
|
|
||||||
this.stopwatch.stop()
|
stopwatch.stop()
|
||||||
logger.info("Cache updated in {} seconds", String.format("%.2f", stopwatch.totalTimeSeconds))
|
logger.info("Cache updated in {} seconds", String.format("%.2f", stopwatch.totalTimeSeconds))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,6 @@ import org.springframework.beans.factory.annotation.Value
|
|||||||
import org.springframework.context.annotation.Profile
|
import org.springframework.context.annotation.Profile
|
||||||
import org.springframework.scheduling.annotation.Scheduled
|
import org.springframework.scheduling.annotation.Scheduled
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import java.time.LocalDateTime
|
|
||||||
import java.time.OffsetDateTime
|
import java.time.OffsetDateTime
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@ -80,7 +79,7 @@ class ImportUsers(
|
|||||||
val bannedUsersCondition = SCORES.IS_BANNED.eq(true)
|
val bannedUsersCondition = SCORES.IS_BANNED.eq(true)
|
||||||
|
|
||||||
val usersResult = this.osuApi.getUsersBatch(userIds)
|
val usersResult = this.osuApi.getUsersBatch(userIds)
|
||||||
Thread.sleep(SLEEP_AFTER_API_CALL)
|
Thread.sleep(SLEEP_AFTER_API_CALL * 2)
|
||||||
|
|
||||||
if (usersResult == null) {
|
if (usersResult == null) {
|
||||||
this.logger.error("Failed to get users")
|
this.logger.error("Failed to get users")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user