film42 / sidekiq-rs

A port of sidekiq to rust using tokio
MIT License
95 stars 10 forks source link

Refactor perform_async opts #1

Closed film42 closed 2 years ago

film42 commented 2 years ago

This cleans up the chain by which we call performasync through the several means. Fixes a bug where worker opts were not propagated to the `perform{in,async}` call. Kind of cool that demo.rs required no changes. Compiles and builds just fine.

I made max_retries(&self) a function on the Worker trait because Box<dyn Worker> is not Sized, therefore I can't call the T::opts() method, which would have been really nice. But, that's ok. I might need to re-think the worker opts pattern. Ideally we could rely on EnqueueOpts, but there's diverging perform functions where EnqueueOpts requires a class string, but WorkerOpts doesn't because it knows it ahead of time through the trait definition.