Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ rvm:
- ruby
- jruby-head
- jruby
- 2.3.0
- 2.2.4
- 2.1.0
- 2.0.0
- 1.9.3
Expand All @@ -23,4 +25,4 @@ notifications:
services:
- redis-server
env:
- CODECLIMATE_REPO_TOKEN=04a9fef09063cdef2f62cf46531329ad01a9383e3de8270e112480052774f676
- CODECLIMATE_REPO_TOKEN=04a9fef09063cdef2f62cf46531329ad01a9383e3de8270e112480052774f676
4 changes: 3 additions & 1 deletion lib/rubykiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
module Rubykiq
extend SingleForwardable

MUTEX_FOR_PERFORM = Mutex.new

def_delegators :client, :<<, :push, :connection_pool, :connection_pool=

# delegate all VALID_OPTIONS_KEYS accessors to the client
Expand All @@ -25,7 +27,7 @@ def self.client(options = {})
private

def self.initialize_client(options = {})
Thread.exclusive do
MUTEX_FOR_PERFORM.synchronize do
@client = Rubykiq::Client.new(options)
end
end
Expand Down
4 changes: 3 additions & 1 deletion lib/rubykiq/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class Client
queue: 'default'
}

MUTEX_FOR_PERFORM = Mutex.new

# Bang open the valid options
attr_accessor(*VALID_OPTIONS_KEYS)

Expand Down Expand Up @@ -202,7 +204,7 @@ def normalize_time(time)
private

def initialize_connection_pool(options = {})
Thread.exclusive do
MUTEX_FOR_PERFORM.synchronize do
@connection_pool = ::ConnectionPool.new(timeout: redis_pool_timeout, size: redis_pool_size) do
Rubykiq::Connection.new(options)
end
Expand Down