Closed cedricpim closed 3 weeks ago
Oh yes! We hit this too, two weeks ago, and I didn't have time to fix it. I'll get a fix soon.
Got a PR ready to fix this. I've just removed that logic. It was added for #41, but now that I've looked at it again, it wasn't necessary. There's no need to connect to a server in the console because not setting one just works; it just uses the default queue adapter for each job, which is what you want unless you have multiple adapters and you want to explicitly connect to one of them, which you can always do via connect_to
.
Thanks for handling it :bow:
Hello :wave:
I have been using this gem and just found out that some surprising behaviour. So, I have been moving an application from using a different queue backend to SolidQueue. For now, only some jobs (and queues) are using SolidQueue and I added
mission_control-jobs
to start tracking that and added this line toapplication.rb
:config.mission_control.jobs.adapters = [:solid_queue]
(since the other queue backend doesn't have an integration and it is not worth adding it).But because of the code in https://github.com/rails/mission_control-jobs/blob/main/lib/mission_control/jobs/console/context.rb and in https://github.com/rails/mission_control-jobs/blob/fe9db51fb3b3c04c4cd97d79480546c64db278d7/lib/mission_control/jobs/engine.rb#L82-L85, it means that, when I run a
rails console
all jobs are run under the SolidQueue adapter (this could be problematic if, for example, I still only have workers for a given queue and not others).I think a safer option could be to disable all this added logic to the console via a configuration like
show_console_help
or a check on https://github.com/rails/mission_control-jobs/blob/fe9db51fb3b3c04c4cd97d79480546c64db278d7/lib/mission_control/jobs/engine.rb#L82 likeapplication.servers.first.name == ActiveJob::Base.queue_adapter_name
(ensuring that the current queue adapter and the queue adapter in mission control is the same).