mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
[ActiveJob] make the resque-scheduler optional
This commit is contained in:
parent
b06d91924f
commit
59221cc4f1
1 changed files with 6 additions and 3 deletions
|
@ -7,9 +7,8 @@ begin
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
begin
|
begin
|
||||||
require 'resque_scheduler'
|
require 'resque_scheduler'
|
||||||
rescue LoadError => e
|
rescue LoadError
|
||||||
$stderr.puts 'The ActiveJob resque adapter requires resque-scheduler. Please add it to your Gemfile and run bundle install'
|
false
|
||||||
raise e
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,6 +21,10 @@ module ActiveJob
|
||||||
end
|
end
|
||||||
|
|
||||||
def enqueue_at(job, timestamp, *args)
|
def enqueue_at(job, timestamp, *args)
|
||||||
|
unless Resque.respond_to?(:enqueue_at_with_queue)
|
||||||
|
raise NotImplementedError, "To be able to schedule jobs with Resque you need the " \
|
||||||
|
"resque-scheduler gem. Please add it to your Gemfile and run bundle install"
|
||||||
|
end
|
||||||
Resque.enqueue_at_with_queue job.queue_name, timestamp, JobWrapper, job.name, *args
|
Resque.enqueue_at_with_queue job.queue_name, timestamp, JobWrapper, job.name, *args
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue