                         rw-lock
                         (fn [domain]
                           (use-cache-or-update domain
-                                               domains-info
+                                               (domain/host-shards (domains-info domain))
                                                global-config
                                                local-config))))
 

             :no-update
             (open-domain local-config
                          (str (path local-dir domain))
                          (domain/host-shards (domains-info domain)))))))))

(defn purge-unused-domains!
  "Walks through the supplied local directory, recursively deleting
  all directories with names that aren't present in the supplied
  `domain-set`."
  [domain-set local-dir]
  (let [lfs (local-filesystem)]
    (dofor [domain-path (-> local-dir mk-local-path .listFiles)
            :when (and (.isDirectory domain-path)
                       (not (contains? domain-set (.getName domain-path))))]
           (log-message "Deleting local path of deleted domain: " domain-path)
           (delete lfs (.getPath domain-path) true))))



;; TODO: examine this... can we remove this use-cache deal?
(defn use-cache-or-update
  ([domain host-shards global-config local-config]
     (->> (mk-loader-state {domain host-shards})
          (use-cache-or-update domain host-shards global-config local-config false)))
  ([domain host-shards global-config local-config update? ^DownloadState state]
     (let [fs (filesystem (:hdfs-conf local-config))
           lfs (local-filesystem)
           local-dir (:local-dir local-config)
