Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
pushex/lib/push_ex/application.ex
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
44 lines (35 sloc)
1009 Bytes
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 PushEx.Application do | |
@moduledoc false | |
use Application | |
def start(_type, _args) do | |
check_config!() | |
set_pool_size() | |
children = [ | |
PushEx.Push.ItemProducer, | |
PushEx.Push.ItemConsumer, | |
PushEx.Instrumentation.Tracker, | |
PushEx.Instrumentation.Supervisor | |
] | |
opts = [strategy: :one_for_one, name: PushEx.Supervisor] | |
Supervisor.start_link(children, opts) | |
end | |
def config_change(changed, _new, removed) do | |
PushExWeb.Endpoint.config_change(changed, removed) | |
:ok | |
end | |
def pool_size do | |
Application.get_env(:push_ex, :internal_pool_size, 1) | |
end | |
defp set_pool_size() do | |
presence_pool_size = | |
Application.get_env(:push_ex, PushExWeb.Endpoint) | |
|> Keyword.get(:pubsub, []) | |
|> Keyword.get(:pool_size, 1) | |
Application.put_env(:push_ex, :internal_pool_size, presence_pool_size) | |
end | |
if Mix.env() == :test do | |
defp check_config!(), do: nil | |
else | |
defp check_config!(), do: PushEx.Config.check!() | |
end | |
end |