 
 (def results (take-segments! out-chan))
 
-(fact @startup-counter => 3)
+(fact @startup-counter => 2)
 
 (doseq [v-peer v-peers]
   (onyx.api/shutdown-peer v-peer))

(doseq [n (range n-messages)]
  (>!! in-chan {:n n}))

(>!! in-chan :done)
(close! in-chan)

(def v-peers (onyx.api/start-peers 4 peer-group))

(onyx.api/submit-job
 peer-config

(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)
