Created
September 17, 2018 12:23
-
-
Save programisti/3b92c273b3261fa5057162095dd45547 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule NDCCoreRequest do | |
require Logger | |
def process_request(conn, :AirShopping, query_data, [forwarded_hosts], [consumer]) do | |
forwarded_hosts | |
|> AirlineProfile.get_providers(consumer) | |
|> Enum.map(fn(provider) -> | |
Task.async(fn -> | |
provider | |
|> String.upcase | |
|> NDCThreadRequest.start_thread(query_data, :AirShopping, consumer) | |
|> Aggregator.add_result(conn) | |
end) | |
end) | |
|> Task.yield_many(extract_timeout) | |
end | |
def process_request(conn, request_name, request_data, [forwarded_host], [consumer]) do | |
NDCThreadRequest.start_thread(forwarded_host, request_data, request_name, consumer) | |
end | |
defp extract_timeout, do: Application.fetch_env!(:ndc_ex_gateway, :gateway_timeout) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment