1
0
Fork 0
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:
Cristian Bica 2014-08-16 15:49:03 +03:00 committed by Abdelkader Boudih
parent b06d91924f
commit 59221cc4f1

View file

@ -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