summaryrefslogtreecommitdiff
path: root/src/site.clj
diff options
context:
space:
mode:
authorScott Ostler <sbsotler@gmail.com>2011-04-19 10:13:58 -0400
committerScott Ostler <sbsotler@gmail.com>2011-04-19 10:13:58 -0400
commita440f0e6766e543212fd2182f11090a8bcbc2570 (patch)
tree5c6f47e2ea9203cb4c5fde438429f6d496f4dd3b /src/site.clj
parent0a4b3ff7a6163e43230418433f4c67fbb15d8621 (diff)
Randomize and limit frontpage dumps
Diffstat (limited to 'src/site.clj')
-rw-r--r--src/site.clj7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/site.clj b/src/site.clj
index 6668fc7..87f9734 100644
--- a/src/site.clj
+++ b/src/site.clj
@@ -210,12 +210,14 @@
(try
(let [msg-ids (re-seq #"\w+"
(slurp frontpage-posts-path))
- msgs (datalayer/fetch-messages-by-id (shuffle msg-ids))]
+ msgs (datalayer/fetch-messages-by-id msg-ids)]
(for [m msgs]
(assoc m :score (hall-score (:message_id m)))))
(catch Exception e (println e) [])))
12000
nil))
+(def num-frontpage-dumps 20)
+
(defn front-page
([session] (front-page session (format-yyyymmdd (Date.))))
([session dt-str]
@@ -227,7 +229,8 @@
dumps (map process-message-for-output
(if (:nick session)
(fetch-redis-daily-hall cur-date 0 20 (:user_id session))
- (poll frontpage-posts-agent)))]
+ (take num-frontpage-dumps
+ (shuffle (poll frontpage-posts-agent)))))]
(.setAttribute st "dumps" dumps)
(if-not (.after next-date today)
(.setAttribute st "next_date" (format-yyyymmdd next-date)))