【发布时间】:2021-08-29 15:02:00
【问题描述】:
:pg2 模块在 OTP 24 中被删除。它的替换是 :pg。根据documentation:
默认作用域 pg 在 kernel(6) 配置时自动启动。
从基于混合的 Elixir 1.12 应用程序,配置内核以自动启动默认 :pg 范围的正确方法是什么?到目前为止,我一直在这样做,但似乎真的很难编写没有 start/2 函数的库代码:
defmodule MyApp do
use Application
def start(_type, _args) do
# Ew, gross:
{:ok, _pid} = :pg.start_link()
children() |> Supervisor.start_link([strategy: :one_for_one, name: __MODULE__])
end
def children, do: []
end
【问题讨论】:
-
** (Mix) Could not start application pg: could not find application file: pg.app:pg 不是应用程序,它是 Erlang 内核的一部分
标签: elixir erlang-otp