Skip to content

Instantly share code, notes, and snippets.

@boxxxie
Created October 6, 2011 16:38
Show Gist options
  • Save boxxxie/1267890 to your computer and use it in GitHub Desktop.
Save boxxxie/1267890 to your computer and use it in GitHub Desktop.
(defn touch-view [db ddoc view]
(db/with-db db (db/get-view ddoc view {:reduce false :limit 0})))
(defn future-touch-view [db ddoc view]
(println sleepTime)
(let [f (future (binding [rest sleepTime](do (touch-view db ddoc view)
(Thread/sleep rest))))]
@f))
(defn touch-views [views]
(map #(future-touch-view (:db %) (:ddoc %) (:view %)) views))
(defn -main [& args]
(println sleepTime)
(let [views (db-ddoc-view-list)]
(repeatedly 2 (fn [] (touch-views views)))))
(binding [sleepTime 1000] (-main))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment