maintenance_tasks icon indicating copy to clipboard operation
maintenance_tasks copied to clipboard

Configure queue globally

Open etiennebarrie opened this issue 3 years ago • 3 comments

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.

etiennebarrie avatar Mar 29 '21 16:03 etiennebarrie

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?

sambostock avatar Mar 30 '21 14:03 sambostock

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.

etiennebarrie avatar Mar 31 '21 19:03 etiennebarrie

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.

sambostock avatar Mar 31 '21 20:03 sambostock

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!

github-actions[bot] avatar Jan 27 '24 01:01 github-actions[bot]