 
 (def poll-frequency 1000)
 
-(defn poll [atom connection-lost-atom fn callback]
-  (go-loop []
-    (let [new-val (async/<! (fn))]
-      (if new-val
-        (do
-          (reset! connection-lost-atom false)
-          (reset! atom new-val)
-          (callback new-val))
-        (reset! connection-lost-atom true))
-      )
-    (async/<! (utils/timeout poll-frequency))
-    (recur)))
-
 (defn poll-and-dispatch [kw connection-lost-atom fn callback]
   (go-loop []
     (let [new-val (async/<! (fn))]

    (async/<! (utils/timeout poll-frequency))
    (recur)))


(defn- most-recent-build-number [state]
  (->> state
       (map :build-number)

    (if (nil? @build-number-atom)
      (route/set-build-number (most-recent-build-number state)))))

(defn poll-history [build-number-atom connection-lost-atom]
  (poll-and-dispatch :history-updated connection-lost-atom api/get-build-history (set-build-number-if-missing build-number-atom)))

(defn poll-state [build-number-atom connection-lost-atom]
  (poll-and-dispatch :pipeline-state-updated connection-lost-atom #(api/get-build-state @build-number-atom) noop))

(defn current-build-header-component [build-number]
