Skip to content

Commit 9c1546c

Browse files
committed
fix: correct timeout bug again
1 parent c23c5c4 commit 9c1546c

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
# Version 0.4.5
2+
3+
Fix timeout being incorrectly called again.
4+
15
# Version 0.4.4
26

37
Fix timeout being incorrectly called.
48

59
# Version 0.4.3
610

7-
Fix warning message for classic tokens. Add time prinout to help judge need for
11+
Fix warning message for classic tokens. Add time printout to help judge need for
812
timeout setting.
913

1014
# Version 0.4.2

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
jekyll-indico (0.4.4)
4+
jekyll-indico (0.4.5)
55
jekyll (>= 3.8, < 5.0)
66

77
GEM

lib/jekyll-indico/core.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,16 @@ def download_and_iterate(base_url, indico_id, timeout: nil, **params, &block)
6969
uri.query = URI.encode_www_form(params)
7070

7171
req = Net::HTTP::Get.new(uri)
72-
req.read_timeout = timeout if timeout
7372
if ENV['INDICO_TOKEN']
7473
req['Authorization'] = "Bearer #{ENV['INDICO_TOKEN']}"
7574
elsif ENV['INDICO_SECRET_KEY'] || ENV['INDICO_API_KEY']
7675
raise Error, 'Use INDICO_TOKEN with a new-style token'
7776
end
7877

79-
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
78+
opts = { use_ssl: true }
79+
opts[:read_timeout] = timeout if timeout
80+
81+
response = Net::HTTP.start(uri.hostname, uri.port, **opts) { |http| http.request(req) }
8082

8183
string = response.body
8284
parsed = JSON.parse(string) # returns a hash

lib/jekyll-indico/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# frozen_string_literal: true
22

33
module JekyllIndico
4-
VERSION = '0.4.4'
4+
VERSION = '0.4.5'
55
end

spec/jekyll-indico_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
context 'with a CERN topical meeting' do
1111
before :all do
12-
@meeting = JekyllIndico::Meetings.new('https://indico.cern.ch', 10570)
12+
@meeting = JekyllIndico::Meetings.new('https://indico.cern.ch', 10570, timeout: 120)
1313
end
1414

1515
it 'has expected meetings' do

0 commit comments

Comments
 (0)