             (swap! requests-in-session inc)
             (-> a-url client/get :body parse-string))
 
-        (and (< (t/in-minutes (t/duration @session-start-time t/now))
+        (and (< (t/in-minutes (t/interval @session-start-time (t/now)))
                 60)
              (> 1000 @requests-in-session))
         (do (swap! requests-in-session inc)
             (-> a-url client/get :body parse-string))
 
-        (and (< (t/in-minutes (t/duration @session-start-time t/now))
+        (and (< (t/in-minutes (t/interval @session-start-time (t/now)))
                 60)
              (<= 1000 @requests-in-session))
         (let [time-to-sleep (* 1000
                                (-
                                 3600
                                 (t/in-secs
-                                 (t/duration @session-start-time
+                                 (t/interval @session-start-time
                                              (t/now)))))]
-          (do (Thead/sleep time-to-sleep) ; sleep till the end of the
+          (do (Thread/sleep time-to-sleep) ; sleep till the end of the
                                           ; hour
                                           ; and then restart the session
               (swap! session-start-time (fn [x] (t/now)))

            (-> credentials (get since-epoch) :api-key)
            "&since="
            since-epoch
            (if cursor (str "&cursor=" cursor) "")))))

(defn rate-limited-download

(ns clueweb-disqus.core
  (:require [cheshire.core :refer :all]
            [clj-http.client :as client]
            [clj-time.coerce :as c]
            [clj-time.core :as t]
            [clj-time.format :as f]
            [clojure.java.io :as io])
  (:use [clojure.pprint :only [pprint]]))

