      (fn [_]
        (let [v-peer (system/onyx-peer peer-group monitoring-config)
              live (component/start v-peer)
-             shutdown-ch (chan 1)
-             ack-ch (chan)
+             shutdown-ch (promise-chan)
+             ack-ch (promise-chan)
              started-peer (atom live)]
          {:peer-lifecycle (future (peer-lifecycle started-peer config shutdown-ch ack-ch))
           :started-peer started-peer

(ns onyx.api
  (:require [clojure.string :refer [split]]
            [clojure.core.async :refer [chan >!! <!! close! alts!! timeout go]]
            [com.stuartsierra.component :as component]
            [taoensso.timbre :refer [info warn fatal error]]
            [onyx.log.entry :refer [create-log-entry]]

              (= ch restart-ch)
              (do (component/stop live)
                  (Thread/sleep (or (:onyx.peer/retry-start-interval config) 2000))
                  (if-let [live (restart-peer live shutdown-ch)]
                    (do (reset! started-peer live)
                        (recur live))
                    (>!! ack-ch true)))
              :else (throw (ex-info "Read from a channel with no response implementation" {})))))
    (catch Throwable e
      (fatal "Peer lifecycle threw an exception")
