Skip to content

Commit

Permalink
Added enqueue_at support for QueAdapter in ActiveJob
Browse files Browse the repository at this point in the history
* Added inline job runner for Que in test/support
* Updated QueAdapter to support enqueue_at
  • Loading branch information
thetron committed Aug 21, 2014
1 parent 2e355fe commit 9b319a5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion activejob/lib/active_job/queue_adapters/que_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions activejob/test/adapters/que.rb
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
require 'support/que/inline'

ActiveJob::Base.queue_adapter = :que
Que.mode = :sync
9 changes: 9 additions & 0 deletions activejob/test/support/que/inline.rb
Original file line number Diff line number Diff line change
@@ -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 9b319a5

Please sign in to comment.