From 20752a3b1c9ad66078b867b842084f399ca77592 Mon Sep 17 00:00:00 2001 From: Felisp Date: Tue, 10 Sep 2024 16:56:41 +0200 Subject: [PATCH] Use last_modified as part of item GUID to fix notification failures --- src/rss_thread_watch/feed_generator.clj | 3 ++- src/rss_thread_watch/watcher.clj | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/rss_thread_watch/feed_generator.clj b/src/rss_thread_watch/feed_generator.clj index e0dcb6c..6342a2c 100644 --- a/src/rss_thread_watch/feed_generator.clj +++ b/src/rss_thread_watch/feed_generator.clj @@ -50,8 +50,9 @@ This is done by concating thread-number and it's rounded chod" [thread] - (assoc thread :guid (format "%d-%.2f" + (assoc thread :guid (format "%d-%d-%.2f" (:no thread) + (:last-modified thread) (:chod thread)))) (defn filter-chod-posts diff --git a/src/rss_thread_watch/watcher.clj b/src/rss_thread_watch/watcher.clj index 689e18c..e87058a 100644 --- a/src/rss_thread_watch/watcher.clj +++ b/src/rss_thread_watch/watcher.clj @@ -38,7 +38,7 @@ (defn process-page "Procesess every thread in page, leaving only relevant information - (title no chod)" + (:title or :com, :no :chod :last_modified)" ([threads-to-index threads-total starting-index] (process-page threads-to-index threads-total starting-index (transient []))) ([remaining-threads threads-total index ret] (if (empty? remaining-threads) @@ -47,13 +47,12 @@ (recur (rest remaining-threads) threads-total (inc index) - ;; We have to somehow include URL which is a problem since the catalog does not contain any - ;; I of course know how to craft it but the result will be kind of 4chan specific (conj! ret {:title (or (:sub thread) ;We use thread title if thread has it (:com thread) ;we use body if thread has it "") ;Thread has neither, this prevents null pointer :no (:no thread) - :chod (* 100 (float (/ index threads-total)))})))))) + :chod (* 100 (float (/ index threads-total))) + :last-modified (:last_modified thread)})))))) (defn build-cache "Build cache of near-death threads so the values don't have to be recalculated on each request."