From c598e3fb726a87251fbb480aacdd37479d766507 Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Wed, 23 Feb 2011 00:21:03 -0500 Subject: redisload testing --- src/redisload.clj | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src') 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 -- cgit v1.2.3-70-g09d2