Created
April 9, 2018 07:52
-
-
Save makefunstuff/91f1a88a9eaed2409e8dc800c12c7d30 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 NaiveSolution do | |
def process(tickets_batch) do | |
tickets | |
|> Enum.map(&async_process/1) | |
|> Enum.map(&Task.await/1) | |
end | |
def async_process(ticket) do | |
Task.async fn() -> | |
ticket | |
# fetching messages for ticket from 3rd party api | |
|> fetch_messages | |
# fetching customer data from 3rd party api | |
|> fetch_customer | |
# insert fetched data | |
|> update | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment