我的问题很像这里描述的问题 Supervision tree failing to start,所提供的解决方案似乎或多或少与我所拥有的相同,除了当子进程失败并显示以下消息时,我的解决方案只是退出:{{1} }.我想知道如何让它“重新启动”(或者更确切地说,由于它尚未真正启动,因此重试启动)。谢谢!
** (Mix) Could not start application server: Server.start(:normal, []) returned an error: shutdown: failed to start child: Server.Gen.StartRabbit
defmodule Server do
use Application
def start(_type, _args) do
import Supervisor.Spec, warn: false
children = [
{
GenRegistry,
worker_module: Server.Gen.Rabbit
},
Server.Gen.StartRabbit,
Plug.Cowboy.child_spec(
scheme: :http,
plug: Server.Router,
options: [
port: String.to_integer(System.get_env("PORT") || "3000"),
dispatch: dispatch(),
protocol_options: [idle_timeout: :infinity]
]
)
]
opts = [strategy: :one_for_one, name: Server.Supervisor]
Supervisor.start_link(children, opts)
end
end