Use last_modified as part of item GUID to fix notification failures

This commit is contained in:
Felisp 2024-09-10 16:56:41 +02:00
parent 62f62a967f
commit 20752a3b1c
2 changed files with 5 additions and 5 deletions

View file

@ -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

View file

@ -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."