Skip to content
Browse files

Merge pull request #16602 from thetron/active_job_que_enqueue_at_support

Added enqueue_at support for QueAdapter in ActiveJob
  • Loading branch information...
2 parents 7df8a0d + 9b319a5 commit 9cc74261d44485a82fd3e74161adbcfed9b1c579 @rafaelfranca rafaelfranca committed Aug 22, 2014
View
2 activejob/lib/active_job/queue_adapters/que_adapter.rb
@@ -9,7 +9,7 @@ def enqueue(job, *args)
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
View
2 activejob/test/adapters/que.rb
@@ -1,2 +1,4 @@
+require 'support/que/inline'
+
ActiveJob::Base.queue_adapter = :que
Que.mode = :sync
View
9 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

0 comments on commit 9cc7426

Please sign in to comment.
Something went wrong with that request. Please try again.