   {})
 
 (defn handle-exception [event lifecycle phase e]
-  :restart)
+  (if (not= phase :lifecycle/after-batch)
+    :restart
+    :kill))
 
 (defn inject-in-ch [event lifecycle]
   {:core.async/chan @in-chan})

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

        (feedback-exception! peer-config job-id (:log (:env test-env)))
        ;; Made it to the end with a successful job completion.
        (is true)))))

(defn after-batch [event lifecycle]
  (when (= @exception-thrower :after-batch)
    (reset! exception-thrower nil)
    (throw (ex-info "Threw exception in after-batch" {})))
  {})

