diff options
author | Cristian Bica <cristian.bica@gmail.com> | 2014-08-16 15:49:03 +0300 |
---|---|---|
committer | Abdelkader Boudih <terminale@gmail.com> | 2014-08-17 23:10:39 +0000 |
commit | 59221cc4f1b8f87553455aad26905c4f28b424f8 (patch) | |
tree | 9af9eb9893e6cc73c2c3bda8fc816fe16a49b49c /activejob | |
parent | b06d91924ffeb07c5ca6a3d96eff288267ee80c6 (diff) | |
download | rails-59221cc4f1b8f87553455aad26905c4f28b424f8.tar.gz rails-59221cc4f1b8f87553455aad26905c4f28b424f8.tar.bz2 rails-59221cc4f1b8f87553455aad26905c4f28b424f8.zip |
[ActiveJob] make the resque-scheduler optional
Diffstat (limited to 'activejob')
-rw-r--r-- | activejob/lib/active_job/queue_adapters/resque_adapter.rb | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/activejob/lib/active_job/queue_adapters/resque_adapter.rb b/activejob/lib/active_job/queue_adapters/resque_adapter.rb index 30a51485bd..384aa0c4cc 100644 --- a/activejob/lib/active_job/queue_adapters/resque_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/resque_adapter.rb @@ -7,9 +7,8 @@ begin rescue LoadError begin require 'resque_scheduler' - rescue LoadError => e - $stderr.puts 'The ActiveJob resque adapter requires resque-scheduler. Please add it to your Gemfile and run bundle install' - raise e + rescue LoadError + false end end @@ -22,6 +21,10 @@ module ActiveJob end 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 end end |