 (def check-restarted-calls
   {:lifecycle/before-task-start (fn [_ _ ]
                                   (swap! startup-counter inc)
+                                  (when (= 2 @startup-counter)
+                                    (>!! in-chan :done)
+                                    (close! in-chan))
                                   {})
    :lifecycle/before-batch (fn [_ _]
                              (when (= (swap! batch-counter inc) 2)


(def results (take-segments! out-chan))

(fact @startup-counter => 3)

(doseq [v-peer v-peers]
  (onyx.api/shutdown-peer v-peer))

  (:require [clojure.core.async :refer [chan >!! <!! close! sliding-buffer]]
            [midje.sweet :refer :all]
            [onyx.plugin.core-async :refer [take-segments!]]
            [onyx.extensions :as extensions]
            [onyx.test-helper :refer [load-config playback-log get-counts]]
            [onyx.api]))

(def id (java.util.UUID/randomUUID))
