                                 shutdown-ch
                                 backends-ch]))]
             (when (= ch backends-ch)
-              (alts! (map (fn [b] [(:channel b) value]) (vals backends))))
+              (let [since (- (millepoch-time-now)
+                             (* 1000 (Integer/parseInt (:upstream-freshness config))))
+                    good-backends (filter (partial healthy-backend? since)
+                                          (vals backends))]
+                (if (seq good-backends)
+                  (alts! (map (fn [b] [(:channel b) value]) good-backends))
+                  (>! (second value) {:status 500 :headers {}
+                                      :body "No healthy downstreams"}))))
             (if (= ch shutdown-ch)
               (.close (first (vals listeners)))
               (recur listeners

(defn print-state [l b]
  (pprint {:listeners l :backends b}))

(defn run-server [prefix]
  (let [shutdown-ch (chan)
        config-watcher (etcd/watch-prefix prefix)

            [manifold.deferred :as d]
            [clojure.string :as str]
            [clojure.set :as set]
            [clojure.instant]
            [clojure.core.async :as async
             :refer [<! go chan >! close! alts!]]
            [aleph.http :as http])
