summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott Ostler <scottbot9000@gmail.com>2011-02-23 00:21:03 -0500
committerScott Ostler <scottbot9000@gmail.com>2011-02-23 00:21:03 -0500
commitc598e3fb726a87251fbb480aacdd37479d766507 (patch)
tree0262d22c21e6c2f21056b945448c9f572763a2c1
parentc1dd8b085ff71a680b29297f507fa3054e99abf9 (diff)
redisload testing
-rw-r--r--src/redisload.clj18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/redisload.clj b/src/redisload.clj
index 26888e3..15ca299 100644
--- a/src/redisload.clj
+++ b/src/redisload.clj
@@ -138,30 +138,32 @@ WHERE
(defn get-top-posts [dt limit]
(do-select ["
- SELECT m.message_id as message_id, count(*) as score
- FROM messages m, tags t, rooms r
+ SELECT u.nick, m.message_id as message_id, count(*) as score
+ FROM messages m, tags t, rooms r, users u
WHERE m.message_id = t.message_id and m.room_id = r.room_id
+ AND u.user_id = m.user_id
AND m.user_id != t.user_id
AND m.created_on::date = ?::date
AND m.is_image
AND r.admin_only = false
- GROUP BY m.message_id
+ GROUP BY u.nick, m.message_id
ORDER BY score DESC
LIMIT ?" (date-to-sql dt) limit]))
(defn build-daily-hall [dt]
(let [top-posts (get-top-posts dt 20)
- datekey (redis-daily-hall-key (format-yyyymmdd dt))]
+ datekey (redis-daily-hall-key dt)]
(println (count top-posts) "posts for" datekey)
(redis/with-server redis-server
(redis/atomically
- (redis/del datekey)
+ ;(redis/del datekey)
(doseq [m top-posts]
- (println (:message_id m) (:score m))
- (redis/zadd datekey (:score m) (:message_id m)))))))
+ (println (:nick m) (:message_id m) (:score m))
+ ;(redis/zadd datekey (:score m) (:message_id m))
+ )))))
(defn build-all-daily-hall []
(doseq [dt (get-fav-date-range)]
(build-daily-hall dt)))
-(build-daily-hall (parse-yyyy-mm-dd-date "2010-05-03")) \ No newline at end of file
+(build-daily-hall (parse-yyyy-mm-dd-date "2010-05-30")) \ No newline at end of file