proletarian

msolli 2023-08-21T08:49:17.616679Z

@lwhorton I don’t see why what you tried to do shouldn’t work. There’s no magic under the hood - the function you pass in as :proletarian/failed-job-fn is invoked without any shenanigans at https://github.com/msolli/proletarian/blob/main/src/proletarian/retry.clj#L62. If you make a minimal app that can reproduce the issue I’ll look into it, though.

lwhorton 2023-08-21T16:34:45.132529Z

the more i look at it, the more i suspect its something off about how i’m using mount. thanks!

msolli 2023-08-21T16:43:02.231549Z

Here’s how I use Mount with Proletarian in an app at work:

(mount/defstate default-worker
  :start (doto (worker/create-queue-worker
                 (:datasource conn/*db*)
                 worker-jobs/handle-job-wrapper!
                 #:proletarian{:queue               :proletarian/default
                               :retry-strategy-fn   worker-jobs/retry-strategy
                               :failed-job-fn       worker-jobs/handle-job-failed!
                               :polling-interval-ms 1000
                               :worker-threads      2
                               :log                 logger
                               :serializer          serializer})
           (worker/start!))
  :stop (worker/stop! default-worker))
I have one more worker in its own defstate, and both workers share the worker-jobs/handle-job-failed! multimethod.