Skip to content

Commit

Permalink
fix deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
DeDiamondPro committed May 5, 2023
1 parent 912af39 commit 8e8aab2
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.*
import org.jetbrains.exposed.sql.SqlExpressionBuilder.greaterEq
import org.jetbrains.exposed.sql.SqlExpressionBuilder.lessEq
import org.jetbrains.exposed.sql.batchInsert
import org.jetbrains.exposed.sql.deleteWhere
import org.jetbrains.exposed.sql.select
Expand Down Expand Up @@ -87,7 +88,7 @@ object ItemFetcher {

timer.scheduleAtFixedRate(10000, config.deleteTime.minutes.inWholeMilliseconds) {
val amountDeleted = transaction {
ItemsTable.deleteWhere { time greaterEq Clock.System.now().plus(config.retentionTime.days) }
ItemsTable.deleteWhere { time lessEq Clock.System.now().minus(config.retentionTime.days) }
}
println("Deleted $amountDeleted rows of old data.")
}
Expand Down

0 comments on commit 8e8aab2

Please sign in to comment.