提交 6ef72079 编写于 作者: A Alberto Almagro

Remove support for Qu gem.

Reasons are that the Qu gem wasn't compatible since Rails 5.1,
gem development was stopped in 2014 and maintainers have
confirmed its demise. See issue #32273
上级 538463bc
......@@ -64,9 +64,6 @@ group :job do
gem "sneakers", require: false
gem "que", require: false
gem "backburner", require: false
# TODO: add qu after it support Rails 5.1
# gem 'qu-rails', github: "bkeepers/qu", branch: "master", require: false
# gem "qu-redis", require: false
gem "delayed_job_active_record", require: false
gem "sequel", require: false
end
......
* Remove support for Qu gem.
Reasons are that the Qu gem wasn't compatible since Rails 5.1,
gem development was stopped in 2014 and maintainers have
confirmed its demise. See issue #32273
*Alberto Almagro*
* Add support for timezones to Active Job.
Record what was the current timezone in effect when the job was
......
......@@ -2,7 +2,6 @@
require "rake/testtask"
# TODO: add qu back to the list after it support Rails 5.1
ACTIVEJOB_ADAPTERS = %w(async inline delayed_job que queue_classic resque sidekiq sneakers sucker_punch backburner test)
ACTIVEJOB_ADAPTERS.delete("queue_classic") if defined?(JRUBY_VERSION)
......
......@@ -7,7 +7,6 @@ module ActiveJob
#
# * {Backburner}[https://github.com/nesquena/backburner]
# * {Delayed Job}[https://github.com/collectiveidea/delayed_job]
# * {Qu}[https://github.com/bkeepers/qu]
# * {Que}[https://github.com/chanks/que]
# * {queue_classic}[https://github.com/QueueClassic/queue_classic]
# * {Resque}[https://github.com/resque/resque]
......@@ -24,7 +23,6 @@ module ActiveJob
# |-------------------|-------|--------|------------|------------|---------|---------|
# | Backburner | Yes | Yes | Yes | Yes | Job | Global |
# | Delayed Job | Yes | Yes | Yes | Job | Global | Global |
# | Qu | Yes | Yes | No | No | No | Global |
# | Que | Yes | Yes | Yes | Job | No | Job |
# | queue_classic | Yes | Yes | Yes* | No | No | No |
# | Resque | Yes | Yes | Yes (Gem) | Queue | Global | Yes |
......@@ -115,7 +113,6 @@ module QueueAdapters
autoload :InlineAdapter
autoload :BackburnerAdapter
autoload :DelayedJobAdapter
autoload :QuAdapter
autoload :QueAdapter
autoload :QueueClassicAdapter
autoload :ResqueAdapter
......
# frozen_string_literal: true
require "qu"
module ActiveJob
module QueueAdapters
# == Qu adapter for Active Job
#
# Qu is a Ruby library for queuing and processing background jobs. It is
# heavily inspired by delayed_job and Resque. Qu was created to overcome
# some shortcomings in the existing queuing libraries.
# The advantages of Qu are: Multiple backends (redis, mongo), jobs are
# requeued when worker is killed, resque-like API.
#
# Read more about Qu {here}[https://github.com/bkeepers/qu].
#
# To use Qu set the queue_adapter config to +:qu+.
#
# Rails.application.config.active_job.queue_adapter = :qu
class QuAdapter
def enqueue(job, *args) #:nodoc:
qu_job = Qu::Payload.new(klass: JobWrapper, args: [job.serialize]).tap do |payload|
payload.instance_variable_set(:@queue, job.queue_name)
end.push
# qu_job can be nil depending on the configured backend
job.provider_job_id = qu_job.id unless qu_job.nil?
qu_job
end
def enqueue_at(job, timestamp, *args) #:nodoc:
raise NotImplementedError, "This queueing backend does not support scheduling jobs. To see what features are supported go to http://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html"
end
class JobWrapper < Qu::Job #:nodoc:
def initialize(job_data)
@job_data = job_data
end
def perform
Base.execute @job_data
end
end
end
end
end
# frozen_string_literal: true
require "qu-immediate"
ActiveJob::Base.queue_adapter = :qu
......@@ -82,7 +82,7 @@ class QueuingTest < ActiveSupport::TestCase
end
test "should supply a provider_job_id when available for immediate jobs" do
skip unless adapter_is?(:async, :delayed_job, :sidekiq, :qu, :que, :queue_classic)
skip unless adapter_is?(:async, :delayed_job, :sidekiq, :que, :queue_classic)
test_job = TestJob.perform_later @id
assert test_job.provider_job_id, "Provider job id should be set by provider"
end
......
# frozen_string_literal: true
module QuJobsManager
def setup
require "qu-rails"
require "qu-redis"
ActiveJob::Base.queue_adapter = :qu
ENV["REDISTOGO_URL"] = "redis://127.0.0.1:6379/12"
backend = Qu::Backend::Redis.new
backend.namespace = "active_jobs_int_test"
Qu.backend = backend
Qu.logger = Rails.logger
Qu.interval = 0.5
unless can_run?
puts "Cannot run integration tests for qu. To be able to run integration tests for qu you need to install and start redis.\n"
exit
end
end
def clear_jobs
Qu.clear "integration_tests"
end
def start_workers
@thread = Thread.new { Qu::Worker.new("integration_tests").start }
end
def stop_workers
@thread.kill
end
def can_run?
begin
Qu.backend.connection.client.connect
rescue
return false
end
true
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册