Created
April 17, 2018 19:34
-
-
Save juddey/1972a5675df5047c81e7163678df0390 to your computer and use it in GitHub Desktop.
Transcoding first attempt
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 Texapp.ServiceMonitor do | |
@services [Texapp.ServiceMonitor.Transcoder] | |
defmodule Result do | |
defstruct score: 0, text: nil, url: nil | |
end | |
def start_link(service, query, query_ref, owner) do | |
service.start_link(query, query_ref, owner) | |
end | |
def compute(query, opts \\ []) do | |
# %{type: moment, id: the id, job_id: Transcoder job id}) | |
services = opts[:services] || @services | |
IO.inspect(services) | |
services | |
|> Enum.map(&spawn_query(&1, query)) | |
end | |
defp spawn_query(service, query) do | |
query_ref = make_ref() | |
opts = [service, query, query_ref, self()] | |
{:ok, pid} = Supervisor.start_child(Texapp.Web.AwsSupervisor, opts) | |
{pid, query_ref} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment