From 50c6a09ff64cb081b27a0c30790b86873449d172 Mon Sep 17 00:00:00 2001 From: href Date: Sat, 17 Feb 2018 21:21:42 +0100 Subject: :) --- lib/lsg/application.ex | 11 +---------- lib/lsg/icecast.ex | 6 +++--- 2 files changed, 4 insertions(+), 13 deletions(-) (limited to 'lib/lsg') diff --git a/lib/lsg/application.ex b/lib/lsg/application.ex index 0df3c87..23db221 100644 --- a/lib/lsg/application.ex +++ b/lib/lsg/application.ex @@ -5,7 +5,6 @@ defmodule LSG.Application do # for more information on OTP Applications def start(_type, _args) do import Supervisor.Spec - {:ok, irc_client} = ExIRC.start_link! # Define workers and child supervisors to be supervised children = [ @@ -16,9 +15,7 @@ defmodule LSG.Application do worker(Registry, [[keys: :duplicate, name: LSG.BroadcastRegistry]]), worker(LSG.IcecastAgent, []), worker(LSG.Icecast, []), - worker(LSG.IRC.ConnectionHandler, [irc_client]), - worker(LSG.IRC.LoginHandler, [irc_client]), - ] ++ irc_handlers(irc_client) + ] ++ LSG.IRC.application_childs # See https://hexdocs.pm/elixir/Supervisor.html # for other strategies and supported options @@ -33,10 +30,4 @@ defmodule LSG.Application do :ok end - defp irc_handlers(irc_client) do - import Supervisor.Spec - for handler <- Application.get_env(:lsg, :irc)[:handlers] do - worker(handler, [irc_client]) - end - end end diff --git a/lib/lsg/icecast.ex b/lib/lsg/icecast.ex index 21a9ea2..07dd4fc 100644 --- a/lib/lsg/icecast.ex +++ b/lib/lsg/icecast.ex @@ -1,7 +1,6 @@ defmodule LSG.Icecast do use GenServer require Logger - @interval 2_500 @hackney_pool :default @httpoison_opts [hackney: [pool: @hackney_pool]] @fuse __MODULE__ @@ -42,7 +41,8 @@ defmodule LSG.Icecast do Logger.error "Icecast HTTP Error: #{inspect error}" state end - :timer.send_after(@interval, :poll) + interval = Application.get_env(:lsg, :icecast_poll_interval, 60_000) + :timer.send_after(interval, :poll) state end @@ -83,7 +83,7 @@ defmodule LSG.Icecast do end defp request(uri, method, body \\ [], headers \\ []) do - headers = [{"user-agent", "LSG-API[lsg.goulag.org] href@random.sh"}] ++ headers + headers = [{"user-agent", "LSG-API[115ans.net, sys.115ans.net] href@random.sh"}] ++ headers options = @httpoison_opts case :ok do #:fuse.ask(@fuse, :sync) do :ok -> run_request(method, uri, body, headers, options) -- cgit v1.2.3