Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rake task pollutes Object methods #28

Open
sharshenov opened this issue Aug 25, 2021 · 0 comments
Open

Rake task pollutes Object methods #28

sharshenov opened this issue Aug 25, 2021 · 0 comments
Milestone

Comments

@sharshenov
Copy link
Member

Every app running via rake sneakers:active_job has Object#populate_workers_by_queues defined because methods of rake tasks are defined globally.

Object.respond_to?(:populate_workers_by_queues, true)
=> true

The rake task can be reworked to avoid the global method

def populate_workers_by_queues
require 'advanced_sneakers_activejob/support/locate_workers_by_queues'
::Rails.application.eager_load!
queues = ENV['QUEUES'].split(',')
workers = AdvancedSneakersActiveJob::Support::LocateWorkersByQueues.new(queues).call
ENV['WORKERS'] = workers.map(&:name).join(',')
end

@sharshenov sharshenov added this to the v0.6 milestone Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant