diff options
author | Nicholas Bruning <nicholas@bruning.com.au> | 2014-08-21 04:19:40 +0000 |
---|---|---|
committer | Nicholas Bruning <nicholas@bruning.com.au> | 2014-08-21 04:27:30 +0000 |
commit | 9b319a53fa880a2407c4836a25f3637d4891fad9 (patch) | |
tree | a95032e52329790322c2b7d3f1e3bbab9ba199bb /activejob | |
parent | 2e355fe0c7f0e4b8a3102864191c0be83fa4c12e (diff) | |
download | rails-9b319a53fa880a2407c4836a25f3637d4891fad9.tar.gz rails-9b319a53fa880a2407c4836a25f3637d4891fad9.tar.bz2 rails-9b319a53fa880a2407c4836a25f3637d4891fad9.zip |
Added enqueue_at support for QueAdapter in ActiveJob
* Added inline job runner for Que in test/support
* Updated QueAdapter to support enqueue_at
Diffstat (limited to 'activejob')
-rw-r--r-- | activejob/lib/active_job/queue_adapters/que_adapter.rb | 2 | ||||
-rw-r--r-- | activejob/test/adapters/que.rb | 2 | ||||
-rw-r--r-- | activejob/test/support/que/inline.rb | 9 |
3 files changed, 12 insertions, 1 deletions
diff --git a/activejob/lib/active_job/queue_adapters/que_adapter.rb b/activejob/lib/active_job/queue_adapters/que_adapter.rb index 0b87deb4e0..9c84c74f83 100644 --- a/activejob/lib/active_job/queue_adapters/que_adapter.rb +++ b/activejob/lib/active_job/queue_adapters/que_adapter.rb @@ -9,7 +9,7 @@ module ActiveJob end def enqueue_at(job, timestamp, *args) - raise NotImplementedError + JobWrapper.enqueue job.name, *args, queue: job.queue_name, run_at: Time.at(timestamp) end end diff --git a/activejob/test/adapters/que.rb b/activejob/test/adapters/que.rb index 640061bf54..e6abc57457 100644 --- a/activejob/test/adapters/que.rb +++ b/activejob/test/adapters/que.rb @@ -1,2 +1,4 @@ +require 'support/que/inline' + ActiveJob::Base.queue_adapter = :que Que.mode = :sync diff --git a/activejob/test/support/que/inline.rb b/activejob/test/support/que/inline.rb new file mode 100644 index 0000000000..2e210acb6b --- /dev/null +++ b/activejob/test/support/que/inline.rb @@ -0,0 +1,9 @@ +require 'que' + +Que::Job.class_eval do + class << self; alias_method :original_enqueue, :enqueue; end + def self.enqueue(*args) + args.pop if args.last.is_a?(Hash) + self.run(*args) + end +end |