diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-10-18 12:49:17 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2018-10-19 12:38:21 +0900 |
commit | 7eba11373c8e986516a848aa08ec21ac8ca592db (patch) | |
tree | bfa536a4fec05a6035bc83accebf4d39f1b7705b | |
parent | 9757c84efefadb57bde18d4b9ee8555ae5b24ccd (diff) | |
download | rails-7eba11373c8e986516a848aa08ec21ac8ca592db.tar.gz rails-7eba11373c8e986516a848aa08ec21ac8ca592db.tar.bz2 rails-7eba11373c8e986516a848aa08ec21ac8ca592db.zip |
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.
-rw-r--r-- | activejob/test/support/integration/adapters/sneakers.rb | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/activejob/test/support/integration/adapters/sneakers.rb b/activejob/test/support/integration/adapters/sneakers.rb index 9af1619d8b..eb8d4cc2d5 100644 --- a/activejob/test/support/integration/adapters/sneakers.rb +++ b/activejob/test/support/integration/adapters/sneakers.rb @@ -1,19 +1,8 @@ # 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 @@ module SneakersJobsManager def bunny_publisher @bunny_publisher ||= begin p = ActiveJob::QueueAdapters::SneakersAdapter::JobWrapper.send(:publisher) - p.safe_ensure_connected + p.ensure_connection! p end end |