diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-22 17:11:31 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-08-22 17:11:31 -0300 |
commit | 9cc74261d44485a82fd3e74161adbcfed9b1c579 (patch) | |
tree | 6f947499be7ab2b216b63c76f9d68bf938a85dfa | |
parent | 7df8a0d463ab4f2bc6a5d427cb6faa188b6354ab (diff) | |
parent | 9b319a53fa880a2407c4836a25f3637d4891fad9 (diff) | |
download | rails-9cc74261d44485a82fd3e74161adbcfed9b1c579.tar.gz rails-9cc74261d44485a82fd3e74161adbcfed9b1c579.tar.bz2 rails-9cc74261d44485a82fd3e74161adbcfed9b1c579.zip |
Merge pull request #16602 from thetron/active_job_que_enqueue_at_support
Added enqueue_at support for QueAdapter in 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 |