import kotlinx.coroutines.launch
import org.h2.api.H2Type.row
import java.io.IOException
+import java.time.LocalDate
object App : Application {
var window: MainWindow? = null
GlobalScope.launch(Dispatchers.IO) {
delay(delayedStart)
+ var lastDelete = LocalDate.MIN;
+
while(true) {
println("Background sync")
try {
}
println("Background sync done")
+ // delete old items if needed
+ val today = LocalDate.now()
+ if(lastDelete != today) {
+ println("Cleanup Items")
+ Database.cleanupItems(settings.maxItemAge)
+ lastDelete = today
+ }
+
// get time until the next feed is pending, but wait at least the minimum delay time
var delayTimeMS = settings.minRefreshWaitTime * 1000L
try {
inner join feedcollections c on f.feedcollection_id = c.feedcollection_id
where i.is_bookmarked = false
and c.max_item_age >= 0)
- where age > max_age
+ where max_age > 0 and age > max_age
)
""".trimIndent()).use { stmt ->
stmt.setInt(1, defaultMaxItemAge)