% SPDX-License-Identifier: LicenseRef-Sovereign-Leviathan-SL-AGPL3-001 % Licensing: see LICENSE in the repository root. %%%------------------------------------------------------------------- %%% @doc HK-BROWSER plane supervisor: the session registry and the %%% session pool are two independent children (not one %%% `simple_one_for_one' supervisor mixing a singleton with dynamic %%% children, which OTP does not allow) so that neither can take the %%% other down. `one_for_one': the registry restarting (it holds no %%% durable state other than in-memory pid mappings, which are %%% rebuilt as sessions re-register) does not restart live sessions, %%% and a session-pool restart storm does not restart the registry. %%% @end %%%------------------------------------------------------------------- -module(hk_browser_sup). -behaviour(supervisor). -export([start_link/0, init/1]). start_link() -> hk_sup_util:start_link_retry( fun() -> supervisor:start_link({local, ?MODULE}, ?MODULE, []) end). init([]) -> SupFlags = #{strategy => one_for_one, intensity => 10, period => 10}, Children = [ #{id => hk_browser_registry, start => {hk_browser_registry, start_link, []}, restart => permanent, shutdown => 5000, type => worker, modules => [hk_browser_registry]}, #{id => hk_browser_session_sup, start => {hk_browser_session_sup, start_link, []}, restart => permanent, shutdown => infinity, type => supervisor, modules => [hk_browser_session_sup]} ], {ok, {SupFlags, Children}}.