From: Olaf Wintermann Date: Mon, 8 Sep 2025 06:09:56 +0000 (+0200) Subject: fix wrong timezone when setting last_update X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=6ea6423a63c85991cb894e74e19b9c9316189205;p=rssreader.git fix wrong timezone when setting last_update --- diff --git a/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt b/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt index 24cc462..54f18ab 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt @@ -303,7 +303,7 @@ object Database { conn.prepareStatement(""" select f.* from feeds f inner join feedcollections c on f.feedcollection_id = c.feedcollection_id - where datediff(ss, coalesce(last_update, '1970-01-01'), now()) > case when c.update_interval > 0 then c.update_interval else ? end + where datediff(ss, coalesce(last_update, '1970-01-01'), now()) + 45 > case when c.update_interval > 0 then c.update_interval else ? end """.trimIndent()).use { stmt -> stmt.setInt(1, defaultInterval) stmt.executeQuery().use { rs -> @@ -383,10 +383,9 @@ object Database { dataSource.connection.use { conn -> feed.lastUpdate = java.time.LocalDateTime.now() conn.prepareStatement(""" - update feeds set last_update = ? where feed_id = ? + update feeds set last_update = now() where feed_id = ? """.trimIndent()).use { stmt -> - stmt.setTimestamp(1, java.sql.Timestamp.valueOf(feed.lastUpdate)) - stmt.setInt(2, feed.id) + stmt.setInt(1, feed.id) stmt.execute() } }