提交 7eba1137 编写于 作者: Y yuuji.yaginuma

Remove an extra `@mutex.synchronize`

Since `@mutex.synchronize` is enforced in the `ensure_connection!` method,
there is no need to do so on the caller side.
https://github.com/jondot/sneakers/blob/c1b47f9c5d5a95da728bbe1700795790e4efbb12/lib/sneakers/publisher.rb#L22-L26

Due to this, `ThreadError(deadlock; recursive locking)` has occurred.
上级 9757c84e
# frozen_string_literal: true
require "sneakers/runner"
require "sneakers/publisher"
require "timeout"
module Sneakers
class Publisher
def safe_ensure_connected
@mutex.synchronize do
ensure_connection! unless connected?
end
end
end
end
module SneakersJobsManager
def setup
ActiveJob::Base.queue_adapter = :sneakers
......@@ -80,7 +69,7 @@ def can_run?
def bunny_publisher
@bunny_publisher ||= begin
p = ActiveJob::QueueAdapters::SneakersAdapter::JobWrapper.send(:publisher)
p.safe_ensure_connected
p.ensure_connection!
p
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册