slugrunner 0.0.4 → 0.0.5

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.
@@ -77,7 +77,7 @@ module Slugrunner
77
77
  start_ts = Time.now
78
78
  stop_ts = start_ts.to_i + @bind_delay
79
79
  while Time.now.to_i < stop_ts
80
- return true if is_port_open?(port)
80
+ return true if port_open?(port)
81
81
  end
82
82
 
83
83
  logger("Port hasn't been open after #{@bind_delay} seconds.")
@@ -130,18 +130,14 @@ module Slugrunner
130
130
  puts("[slugrunner] #{str}")
131
131
  end
132
132
 
133
- def is_port_open?(port)
134
- Timeout::timeout(1) do
135
- begin
136
- s = TCPSocket.new('localhost', port)
137
- s.close
138
- return true
139
- rescue
140
- return false
141
- end
142
- end
133
+ def port_open?(port)
134
+ # no need for timeout as we always connect to localhost
135
+ s = TCPSocket.new('localhost', port)
136
+ return true
143
137
  rescue
144
138
  return false
139
+ ensure
140
+ s.close if s
145
141
  end
146
142
 
147
143
  def fetch_slug
@@ -1,3 +1,3 @@
1
1
  module Slugrunner
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slugrunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-18 00:00:00.000000000 Z
12
+ date: 2014-03-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler