mirror of
https://github.com/inspec/inspec
synced 2024-11-26 22:50:36 +00:00
Avoid connection timeout of "inspec version" (#1538)
* Add open_timeout to NET::HTTP.start call Signed-off-by: Makoto Nozaki <makoto.nozaki@twosigma.com> * Code cleanup based on the discussion at #1538 Signed-off-by: Makoto Nozaki <makoto.nozaki@twosigma.com>
This commit is contained in:
parent
66dce387ee
commit
f913b56ffc
1 changed files with 3 additions and 2 deletions
|
@ -8,8 +8,9 @@ class LatestInSpecVersion
|
|||
# fetches the latest version from rubygems server
|
||||
def latest
|
||||
uri = URI('https://rubygems.org/api/v1/gems/inspec.json')
|
||||
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') {|http|
|
||||
http.read_timeout = 0.5
|
||||
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https',
|
||||
open_timeout: 0.5, read_timeout: 0.5
|
||||
) {|http|
|
||||
http.get(uri.path)
|
||||
}
|
||||
inspec_info = JSON.parse(res.body)
|
||||
|
|
Loading…
Reference in a new issue