maintenance_tasks
maintenance_tasks copied to clipboard
Configure queue globally
Most users who define a custom job queue do it in order to define the queue. I think we could offer a way to do it directly from an initializer, removing the need for a custom job most of the time.
Isn't this already possible by calling queue_as
on the job class? Seems to be public
.
MaintenanceTasks::TaskJob.queue_as(...) { ... }
Though maybe we want an interface that just forwards to that behind the scenes, so it doesn't feel like you're reaching into the job?
Great point! Like you say, I'm not entirely sure it's an API we want to push forward but maybe the solution is just to document this in the README. Adding a method on MaintenanceTasks
that forwards makes sense, and still works when TaskJob is inherited, but it would have to be implemented differently if #383 was resolved, or it would stop working in this case. So maybe documenting the more transparent solution is enough.
Yeah, I was trying to come up with something elegant, but it really breaks down if we don't know the job class ourselves.
I think documenting queue_as
, and then documenting a migration path if we ever break it is the way to go. It's simple, uses the familiar Active Job API, and doesn't require us to implement our own version of queue_as
.
This issue has been marked as stale because it has not been commented on in two months. Please reply in order to keep the issue open. Otherwise, it will close in 14 days. Thank you for contributing!