   "Get latest cluster statistics"
   []
   (let [cached-hosts (vals @cache)
-        active-hosts (active-hosts-memo)
+        active-hosts (active-hosts)
         hosts (filter #(contains? active-hosts (:id %)) cached-hosts)
         sum-fn (fn [ks] (reduce + (map #(get-in % ks) hosts)))
         mean-fn (fn [ks] (/ (sum-fn ks) (count hosts)))]


(defn ready? []
  (not (and (empty? @cache)
            (empty? (active-hosts-memo)))))

(defn store-to-cache
  "Store stats in local cache"

            [swarmpit.influxdb.mapper :as m]
            [swarmpit.config :refer [config]]))

(def nodes-memo (memo/ttl docker/nodes :ttl/threshold 5000))

(defn active-hosts
  []
  "List of running nodes"
  (->> (nodes-memo)
       (filter #(= "ready" (get-in % [:Status :State])))
       (map :ID)
       (set)))

(def cache (atom (cache/basic-cache-factory {})))

