Remove (supervisor) opts from Omnibot.Plugin opts, update Plugin.Supervisor to use :one_for_all strategy by default
Plugin opts no longer contains options for the supervisors that watch plugins, and said supervisors now adopt the one_for_all strategy. This is because these servers *generally* need one another to stay alive. Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
defmodule Omnibot.Plugin do
|
||||
@default_opts [include_base: true, opts: [strategy: :one_for_one]]
|
||||
@default_opts [include_base: true] # strategy: one_for_all
|
||||
|
||||
defmodule CfgState do
|
||||
use Agent
|
||||
@@ -16,7 +16,6 @@ defmodule Omnibot.Plugin do
|
||||
|
||||
def update_state(pid, fun, timeout \\ 5000) do
|
||||
Agent.update(pid, fn {cfg, state} -> {cfg, apply(fun, [state])} end, timeout)
|
||||
#Agent.update(pid, &{&1, apply(fun, [&1])}, timeout)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -22,6 +22,6 @@ defmodule Omnibot.Plugin.Supervisor do
|
||||
@impl true
|
||||
def init({plugin, cfg}) when is_atom(plugin) do
|
||||
children = plugin.plugin_children(cfg)
|
||||
Supervisor.init(children, strategy: :one_for_one)
|
||||
Supervisor.init(children, strategy: :one_for_all)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user