                 (when (p-ext/pending? pipeline event m)
                   (taoensso.timbre/trace (format "Input retry message %s" m))
                   (->> (p-ext/retry-segment pipeline event m)
-                       (call-with-lifecycle-handler
-                        event
-                        :lifecycle/after-retry-segment
-                        (:onyx.core/compiled-handle-exception-fn event)
-                        compiled-after-retry-segment-fn
-                        event
-                        m))))
+                       (lc/invoke-after-retry event compiled-after-retry-segment-fn m))))
               (swap! (:onyx.core/state event) update :timeout-pool rsc/expire-bucket)
               (recur))))))))
 

  event)

(defn inject-batch-resources [compiled-before-batch-fn pipeline event]
  (let [rets (-> (call-with-lifecycle-handler
                  event
                  :lifecycle/before-batch
                  (:onyx.core/compiled-handle-exception-fn event)
                  compiled-before-batch-fn
                  event)
                 (assoc :onyx.core/lifecycle-id (uuid/random-uuid)))]
    (taoensso.timbre/trace (format "[%s / %s] Started a new batch"
                                   (:onyx.core/id rets) (:onyx.core/lifecycle-id rets)))


                   (= ch retry-ch)
                   (->> (p-ext/retry-segment pipeline event v)
                        (lc/invoke-after-retry event compiled-after-retry-segment-fn v))

                   (= ch seal-ch)
                   (do
