提交 9f6461a2 编写于 作者: I InJung Chung

Added instance variable `@queue` to JobWrapper.

This will fix issues in [resque-scheduler](https://github.com/resque/resque-scheduler) `#job_to_hash` method,
so we can use `#enqueue_delayed_selection`, `#remove_delayed` method in resque-scheduler smoothly.
上级 fd0c33d7
......@@ -24,4 +24,12 @@
*DHH*
* Added instance variable `@queue` to JobWrapper.
This will fix issues in [resque-scheduler](https://github.com/resque/resque-scheduler) `#job_to_hash` method,
so we can use `#enqueue_delayed_selection`, `#remove_delayed` method in resque-scheduler smoothly.
*mu29*
Please check [5-0-stable](https://github.com/rails/rails/blob/5-0-stable/activejob/CHANGELOG.md) for previous changes.
......@@ -27,6 +27,7 @@ module QueueAdapters
# Rails.application.config.active_job.queue_adapter = :resque
class ResqueAdapter
def enqueue(job) #:nodoc:
JobWrapper.instance_variable_set(:@queue, job.queue_name)
Resque.enqueue_to job.queue_name, JobWrapper, job.serialize
end
......
......@@ -43,6 +43,13 @@ class QueuingTest < ActiveSupport::TestCase
end
end
test "resque JobWrapper should have instance variable queue" do
skip unless adapter_is?(:resque)
job = ::HelloJob.set(wait: 5.seconds).perform_later
hash = Resque.decode(Resque.find_delayed_selection { true }[0])
assert_equal hash["queue"], job.queue_name
end
test "should not run job enqueued in the future" do
begin
TestJob.set(wait: 10.minutes).perform_later @id
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册