This is neat, but I feel like it takes away too much flexibility. Job classes can be customized to use certain queues, rescue/retry/discard on specific errors, and can be extended quickly when necessary. I can see this being useful in very simple situations, but the syntax is a little confusing (my instinct was to think that the jobify method was class level, like delegate or has_one).
In your README you mentioned that one barrier for writing more jobs is âactivation energyâ, which I think is referring to the time it takes to write a new job class. Thatâs sort of invalidated when you can rails g job MyTinyJob.
Thanks for the feedback! I see what you mean regarding the generators. However in most rails shops I have seen, this was still not done very often. Maybe also due to other reasons.
As for different queues etc. that is on the Todo list. But first I want to see if there is any interest, or some technical reason I missed meaning this is a terrible idea.
Regarding begin / rescue those you can also add to the method you are âjobifyingâ.
In essence though, this is mostly thought as something to easily turn a small method into a bg job.
Your instinct was correct btw, jobify is class level. You add it after a method definition to create a bg version of that method.
Sidekiq used to have this feature and called it âDelayed extensionsâ. It was disabled by default in version 5.0 and removed in version 7.0. You can find the authorâs reasoning here, and check if it applies to your own implementation:
Thanks! It did not apply. Jobify did not suffer from the same issue. However, I have since decided against the whole thing in favour of Subclasses like User::SomeTaskJob < ApplicationJob, which are almost as clean and without all the bells and whistles and much less complexity added.