From 59221cc4f1b8f87553455aad26905c4f28b424f8 Mon Sep 17 00:00:00 2001 From: Cristian Bica Date: Sat, 16 Aug 2014 15:49:03 +0300 Subject: [ActiveJob] make the resque-scheduler optional --- activejob/lib/active_job/queue_adapters/resque_adapter.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'activejob/lib/active_job/queue_adapters/resque_adapter.rb') 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 -- cgit v1.2.3