 (def num-return-chans 50)
 
 (defn run-doi-resolution []
-  ; Insert recently published.
-  (let [yesterday (t/minus (t/now) (t/days 1))
+  ; Insert recently published. There may be a delay in getting metdata 
+  (let [yesterday (t/minus (t/now) (t/days 5))
         today (t/plus (t/now) (t/days 1))
         recently-published (k/select d/events-isam (k/where (and (= :type issued-type-id)
                                                              (>= :event (coerce/to-sql-date yesterday))

          (locking *out* (prn "Finish resolve" doi ok))
          (when ok
            [first-redirect last-redirect (count redirects)]))
    (catch Exception ex (do (prn "Ex" ex) nil))))

(defn insert-resolutions
  [doi first-direct last-redirect]

    (let [url (crdoi/normalise-doi doi)
          result (try-try-again {:sleep 5000 :tries 2} #(client/head url
                                                         {:follow-redirects true
                                                          :throw-exceptions true
                                                          :socket-timeout 5000
                                                          :conn-timeout 5000
                                                          :headers {"Referer" "chronograph.crossref.org"}}))
