Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for que name to Que adapter. #38635

Merged
merged 1 commit into from Mar 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions activejob/CHANGELOG.md
@@ -1,3 +1,7 @@
* Add queue name support to Que adapter

*Brad Nauta*, *Wojciech Wnętrzak*

* Don't run `after_enqueue` and `after_perform` callbacks if the callback chain is halted.

class MyJob < ApplicationJob
Expand Down
4 changes: 2 additions & 2 deletions activejob/lib/active_job/queue_adapters/que_adapter.rb
Expand Up @@ -18,13 +18,13 @@ module QueueAdapters
# Rails.application.config.active_job.queue_adapter = :que
class QueAdapter
def enqueue(job) #:nodoc:
que_job = JobWrapper.enqueue job.serialize, priority: job.priority
que_job = JobWrapper.enqueue job.serialize, priority: job.priority, queue: job.queue_name
job.provider_job_id = que_job.attrs["job_id"]
que_job
end

def enqueue_at(job, timestamp) #:nodoc:
que_job = JobWrapper.enqueue job.serialize, priority: job.priority, run_at: Time.at(timestamp)
que_job = JobWrapper.enqueue job.serialize, priority: job.priority, queue: job.queue_name, run_at: Time.at(timestamp)
job.provider_job_id = que_job.attrs["job_id"]
que_job
end
Expand Down
2 changes: 1 addition & 1 deletion activejob/test/integration/queuing_test.rb
Expand Up @@ -15,7 +15,7 @@ class QueuingTest < ActiveSupport::TestCase
end

test "should not run jobs queued on a non-listening queue" do
skip if adapter_is?(:inline, :async, :sucker_punch, :que)
skip if adapter_is?(:inline, :async, :sucker_punch)
old_queue = TestJob.queue_name

begin
Expand Down
2 changes: 1 addition & 1 deletion activejob/test/support/integration/adapters/que.rb
Expand Up @@ -25,7 +25,7 @@ def start_workers

@thread = Thread.new do
loop do
Que::Job.work
Que::Job.work("integration_tests")
sleep 0.5
end
end
Expand Down
1 change: 1 addition & 0 deletions activejob/test/support/que/inline.rb
Expand Up @@ -9,6 +9,7 @@ def self.enqueue(*args)
options = args.pop
options.delete(:run_at)
options.delete(:priority)
options.delete(:queue)
args << options unless options.empty?
end
run(*args)
Expand Down