Tweaked min cutoffs
This commit is contained in:
parent
6954d66927
commit
f4ea501fa6
@ -17,6 +17,7 @@ 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.OffsetDateTime
|
||||||
|
|
||||||
@Profile("fix:scores")
|
@Profile("fix:scores")
|
||||||
@Service
|
@Service
|
||||||
@ -43,9 +44,20 @@ class FixOldScores(
|
|||||||
|
|
||||||
data class Task(val offset: Int, val limit: Int)
|
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)
|
@Scheduled(fixedDelay = 120000, initialDelay = 0)
|
||||||
fun fixOldScores() {
|
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)
|
val totalRows = dslContext.fetchCount(SCORES, condition)
|
||||||
|
|
||||||
if(totalRows <= 0) {
|
if(totalRows <= 0) {
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class SendScoresToDiscord(
|
|||||||
|
|
||||||
// 2024-03-03 00:00:00
|
// 2024-03-03 00:00:00
|
||||||
private val minCutoff = OffsetDateTime.of(
|
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)
|
@Scheduled(fixedDelay = 1200000, initialDelay = 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user