-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Not an issue. #38
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not really an issue not sure where else to post this. I added the functionality to pass what handler you want to run for a worker. This allows you to have multiple workers going and some looking for this handler and some looking for this handler. Just wanted to add that this is an awesome plugin. Below is the updated code.
usage
Delayed::Worker.new(:min_priority => ENV['MIN_PRIORITY'], :max_priority => ENV['MAX_PRIORITY'], :handler => handler).start
updated files
job.rb
added to set what handler to run
def self.find_available(worker_name, limit = 5, max_run_time = max_run_time, handler = nil)
#added to set what handler to run
unless handler.nil?
if min_priority
scope = self.ready_to_run(worker_name, max_run_time).with_handler(handler).min_priority.by_priority(limit)
elsif max_priority
scope = self.ready_to_run(worker_name, max_run_time).with_handler(handler).max_priority.by_priority(limit)
else
scope = self.ready_to_run(worker_name, max_run_time).with_handler(handler).by_priority(limit)
end
else
if min_priority
scope = self.ready_to_run(worker_name, max_run_time).min_priority.by_priority(limit)
elsif max_priority
scope = self.ready_to_run(worker_name, max_run_time).max_priority.by_priority(limit)
else
scope = self.ready_to_run(worker_name, max_run_time).by_priority(limit)
end
end
worker.rb
def initialize(options={})
@quiet = options[:quiet]
def reserve_and_run_one_job(max_run_time = job_max_run_time)
The text was updated successfully, but these errors were encountered: