Hello.
I cannot run mix test
due to this error.
18:22:11.758 [error] GenServer {Oban.Registry, {Oban, {:plugin, Oban.Plugins.Stager}}} terminating
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.1432.0>.
When using ownership, you must manage connections in one
of the four ways:
* By explicitly checking out a connection
* By explicitly allowing a spawned process
* By running the pool in shared mode
* By using :caller option with allowed process
The first two options require every new process to explicitly
check a connection out or be allowed by calling checkout or
allow respectively.
The third option requires a {:shared, pid} mode to be set.
If using shared mode in tests, make sure your tests are not
async.
The fourth option requires [caller: pid] to be used when
checking out a connection from the pool. The caller process
should already be allowed on a connection.
If you are reading this error, it means you have not done one
of the steps above or that the owner process has crashed.
(db_connection 2.4.0) lib/db_connection.ex:883: DBConnection.transaction/3
(oban 2.7.2) lib/oban/plugins/stager.ex:83: anonymous fn/2 in Oban.Plugins.Stager.handle_info/2
(telemetry 0.4.3) /Users/useeer/Documents/github/xxx/deps/telemetry/src/telemetry.erl:272: :telemetry.span/3
(oban 2.7.2) lib/oban/plugins/stager.ex:82: Oban.Plugins.Stager.handle_info/2
(stdlib 3.15.1) gen_server.erl:695: :gen_server.try_dispatch/4
(stdlib 3.15.1) gen_server.erl:771: :gen_server.handle_msg/6
(stdlib 3.15.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :stage
I added oban
in the project, and the error occurs with oban.
config.exs
config :proj, Oban,
repo: Proj.Repo,
plugins: [
Oban.Plugins.Pruner,
{Oban.Plugins.Cron,
crontab: [
# {"work", ProjWeb._Worker}
]}
],
queues: [default: 10, event: 50]
application.ex
children = [
...
{Oban, oban_config()}
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Proj.Supervisor]
Supervisor.start_link(children, opts)
I don’t know where to check to solve the error.