Tweaked min cutoffs

This commit is contained in:
nise.moe 2024-03-04 13:21:59 +01:00
parent 6954d66927
commit f4ea501fa6
2 changed files with 14 additions and 2 deletions

View File

@ -17,6 +17,7 @@ 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.OffsetDateTime
@Profile("fix:scores")
@Service
@ -43,9 +44,20 @@ class FixOldScores(
data class Task(val offset: Int, val limit: Int)
/**
* This is the minimum cutoff date for scores to be processed.
* You can set a really old date (e.g. 2023-01-01) here to process all scores.
*/
private val minCutoff = OffsetDateTime.of(
2024, 3, 1, 0, 0, 0, 0, OffsetDateTime.now().offset
)
@Scheduled(fixedDelay = 120000, initialDelay = 0)
fun fixOldScores() {
val condition = SCORES.REPLAY.isNotNull.and(SCORES.VERSION.lessThan(CURRENT_VERSION))
val condition = SCORES.REPLAY.isNotNull
.and(SCORES.VERSION.lessThan(CURRENT_VERSION))
.and(SCORES.ADDED_AT.greaterOrEqual(minCutoff))
val totalRows = dslContext.fetchCount(SCORES, condition)
if(totalRows <= 0) {

View File

@ -36,7 +36,7 @@ class SendScoresToDiscord(
// 2024-03-03 00:00:00
private val minCutoff = OffsetDateTime.of(
2024, 3, 3, 0, 0, 0, 0, OffsetDateTime.now().offset
2024, 3, 4, 0, 0, 0, 0, OffsetDateTime.now().offset
)
@Scheduled(fixedDelay = 1200000, initialDelay = 0)