Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #543 from CDCgov/opentimeout-debug
Browse files Browse the repository at this point in the history
Debugging net:opentimeout
  • Loading branch information
kierk authored Dec 10, 2018
2 parents 6be836d + 01c83dc commit 1856222
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions app/controllers/concept_service_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,17 @@ class ConceptServiceController < ApplicationController

# GET /concepts/systems
def systems
@response = HTTParty.get(CONCEPT_SYSTEM_URL)
@response = HTTParty.get(CONCEPT_SYSTEM_URL, open_timeout: 5)
render json: @response.body, status: @response.code
rescue Net::OpenTimeout
render status: 504, json: { message: 'Error opening network connection' }
end

# GET /concepts/search
def search
@response = HTTParty.get(CONCEPT_SEARCH_URL, query: { system: params[:system], version: params[:version], search: params[:search] })
@response = HTTParty.get(CONCEPT_SEARCH_URL, { open_timeout: 5 }, query: { system: params[:system], version: params[:version], search: params[:search] })
render json: @response.body, status: @response.code
rescue Net::OpenTimeout
render status: 504, json: { message: 'Error opening network connection' }
end
end
2 changes: 1 addition & 1 deletion features/support/env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
require_relative '../../test/elastic_helpers'
FakeWeb.register_uri(:any, %r{http://example\.com:9200/}, body: '{}', content_type: 'application/json')

FakeWeb.register_uri(:any, %r{http://concept-manager\..*\.xip\.io}, body: '{}')
FakeWeb.register_uri(:any, %r{http://concept-manager\..*}, body: '{}')

Capybara.register_driver :chrome do |app|
driver = Capybara::Selenium::Driver.new(app, browser: :chrome)
Expand Down

0 comments on commit 1856222

Please sign in to comment.