indocker 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dbe3ccb46e2212e0f4792ff6d528e3da20efbcf793c519b29dc76bd3cf1f2393
4
- data.tar.gz: a7971075ca1ce8febaef30db0217c9d353536fc2f0f792def4fbf898ba68333c
3
+ metadata.gz: cacf753d2ac5b563b097493cdb495f76b2d1aef8f758dea6d84a3791e36ab0aa
4
+ data.tar.gz: bbd59aec061d7358c3d5a579615547c3a3c097219069d93bbd7e78563f31b091
5
5
  SHA512:
6
- metadata.gz: c7f1a7abced7f6fcf440218bd407714e4a8f53f897d752218493ee3162193a8cdf2eeadd5a204bc8c03b9c263617dd0d97b7f09ede7818bdb79638a61d7aabc8
7
- data.tar.gz: e51552f9e3de3a1a27b028e74a4ea6d00efe04db6ca31e59a15cc323e49374f48968ea00b94f4147debff6696ac8a88ba317a59e85f4d8ce1d6ccd6ff2641839
6
+ metadata.gz: f57b65eb2d10ae48aef8295db38822e3d2f55f11d04e912628884b8bbf3e88ff60d95453c086ea4352e1cd0c3d35e4c51682e1dda7bf3e7826502e36c0b27ec9
7
+ data.tar.gz: a3732e6bc974c22b3dd5f856c593054d300d1d6244ac5399cb43d9cdd896940aa9089d0240ce5c8f83481a9e3b51507227d1c4510b66563025b6b5266f56491c
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- indocker (0.1.13)
4
+ indocker (0.1.14)
5
5
  net-ssh
6
6
 
7
7
  GEM
@@ -3,24 +3,13 @@ class Indocker::ServerPools::DeployServerPool
3
3
  @logger = logger
4
4
  @configuration = configuration
5
5
  @connections = []
6
+ @semaphore = Mutex.new
6
7
  end
7
8
 
8
9
  def create_connection!(server)
9
- connection = @connections.detect do |connection|
10
- connection.server.host == server.host &&
11
- connection.server.port == server.port &&
12
- connection.server.user == server.user
10
+ @semaphore.synchronize do
11
+ create_connection_unsafe!(server)
13
12
  end
14
- if connection.nil?
15
- connection = Indocker::ServerPools::DeployServerConnection.new(
16
- logger: @logger,
17
- configuration: @configuration,
18
- server: server,
19
- )
20
- connection.create_session!
21
- @connections.push(connection)
22
- end
23
- connection
24
13
  end
25
14
 
26
15
  def each(&proc)
@@ -30,4 +19,23 @@ class Indocker::ServerPools::DeployServerPool
30
19
  def close_sessions
31
20
  @connections.each(&:close_session)
32
21
  end
22
+
23
+ private
24
+ def create_connection_unsafe!(server)
25
+ connection = @connections.detect do |connection|
26
+ connection.server.host == server.host &&
27
+ connection.server.port == server.port &&
28
+ connection.server.user == server.user
29
+ end
30
+ if connection.nil?
31
+ connection = Indocker::ServerPools::DeployServerConnection.new(
32
+ logger: @logger,
33
+ configuration: @configuration,
34
+ server: server,
35
+ )
36
+ connection.create_session!
37
+ @connections.push(connection)
38
+ end
39
+ connection
40
+ end
33
41
  end
@@ -1,3 +1,3 @@
1
1
  module Indocker
2
- VERSION = "0.1.13"
2
+ VERSION = "0.1.14"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: indocker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.13
4
+ version: 0.1.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov