tres/message_handler: Remove an unused argument

This commit is contained in:
Eishun Kondoh 2018-06-04 12:08:08 +09:00
parent 8a3fa3c0b7
commit 327a2c3dcd
3 changed files with 10 additions and 6 deletions

View file

@ -8,11 +8,9 @@ defmodule Tres.Application do
def start(_type, _args) do
import Supervisor.Spec
{cb_mod, _cb_args} = Tres.Utils.get_callback_module()
children = [
worker(Registry, [[keys: :unique, name: SwitchRegistry]], id: SwitchRegistry),
supervisor(Tres.MessageHandlerSup, [cb_mod], id: MessageHandlerSup),
supervisor(Tres.MessageHandlerSup, [], id: MessageHandlerSup),
supervisor(OVSDB, [], id: OVSDB)
]

View file

@ -1,11 +1,11 @@
defmodule Tres.MessageHandlerSup do
use DynamicSupervisor
def start_link(cb_mod) do
DynamicSupervisor.start_link(__MODULE__, [cb_mod], name: __MODULE__)
def start_link() do
DynamicSupervisor.start_link(__MODULE__, [], name: __MODULE__)
end
def init([_cb_mod]) do
def init(_init_args) do
DynamicSupervisor.init(strategy: :one_for_one)
end
@ -13,4 +13,10 @@ defmodule Tres.MessageHandlerSup do
{cb_mod, cb_args} = Tres.Utils.get_callback_module()
DynamicSupervisor.start_child(__MODULE__, {cb_mod, [{dpid, aux_id}, cb_args]})
end
@spec count_handlers() :: non_neg_integer()
def count_handlers do
count_value = DynamicSupervisor.count_children(__MODULE__)
count_value[:active]
end
end