Skip to content

Commit

Permalink
Retry IO.select in Probe Server instead of returning early (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
bensheldon authored Aug 8, 2023
1 parent e062cee commit 8f96279
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/good_job/http_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def handle_connections
while @running.true?
begin
ready_sockets, = IO.select([@server], nil, nil, SOCKET_READ_TIMEOUT)
return unless ready_sockets
next unless ready_sockets

client = @server.accept_nonblock(exception: false)
request = client.gets
Expand Down
9 changes: 9 additions & 0 deletions spec/lib/good_job/probe_server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@
ip_addresses.each do |ip_address|
response = Net::HTTP.get(ip_address, "/", port)
expect(response).to eq("OK")

response = Net::HTTP.get(ip_address, "/status", port)
expect(response).to eq("OK")

response = Net::HTTP.get(ip_address, "/status/started", port)
expect(response).to eq("Not started")

response = Net::HTTP.get(ip_address, "/status/connected", port)
expect(response).to eq("Not connected")
end
end
end
Expand Down

0 comments on commit 8f96279

Please sign in to comment.