From 6ea6423a63c85991cb894e74e19b9c9316189205 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Mon, 8 Sep 2025 08:09:56 +0200 Subject: [PATCH] fix wrong timezone when setting last_update --- .../src/main/kotlin/de/unixwork/rssreader/Database.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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() } } -- 2.47.3