在 Cowboy github 上提供的示例中,以及我在网上找到的其他一些示例中,有一个一对一的主管似乎什么都不做。我什至相信我看到了一个带有以下评论的示例,“就像真正的主管什么都不做一样”。
这么多牛仔示例中的主管模块的目的是什么?
从 echo_get 示例:
%% Feel free to use, reuse and abuse the code in this file.
%% @private-module(echo_get_sup).
-behaviour(supervisor).
%% API.
-export([start_link/0]).
%% supervisor.
-export([init/1]).
%% API.
-spec start_link() -> {ok, pid()}.
start_link() ->
supervisor:start_link({local, ?MODULE}, ?MODULE, []).
%% supervisor.
init([]) ->
Procs = [],
{ok, {{one_for_one, 10, 10}, Procs}}.