]> uap-core.de Git - rssreader.git/commitdiff
fix wrong timezone when setting last_update
authorOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 8 Sep 2025 06:09:56 +0000 (08:09 +0200)
committerOlaf Wintermann <olaf.wintermann@gmail.com>
Mon, 8 Sep 2025 06:09:56 +0000 (08:09 +0200)
rss-application/src/main/kotlin/de/unixwork/rssreader/Database.kt

index 24cc462b356b49814eaee18dc5242c43a652b5b4..54f18ab5a417a7fccd3ec3befccf53be64f312f4 100644 (file)
@@ -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()
             }
         }