Hi,
The library is very good and works fine for my delayed email sending functionality. But I am facing a problem, when I add the child worker in supervisor tree, like this
def start(_type, _args) do
# List all child processes to be supervised
children = [
# Start the Ecto repository
MyApp.Repo,
# Start the Endpoint (http/https)
MyAppWeb.Endpoint,
{MyApp.JobQueue, repo: MyApp.Repo, max_demand: 100},
{Task.Supervisor, [name: MyApp.TaskSupervisor]}
]
I am unable to run any tests. Getting the error like this
I am getting the error
** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.847.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.
See Ecto.Adapters.SQL.Sandbox docs for more information.
(ecto_sql 3.3.3) lib/ecto/adapters/sql.ex:609: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.3.3) lib/ecto/adapters/sql.ex:545: Ecto.Adapters.SQL.execute/5
(ecto 3.3.2) lib/ecto/repo/queryable.ex:192: Ecto.Repo.Queryable.execute/4
(ecto_job 3.0.0) lib/ecto_job/producer.ex:184: EctoJob.Producer.dispatch_jobs/2
(gen_stage 0.14.3) lib/gen_stage.ex:2103: GenStage.noreply_callback/3
(stdlib 3.11.1) gen_server.erl:637: :gen_server.try_dispatch/4
(stdlib 3.11.1) gen_server.erl:711: :gen_server.handle_msg/6
(stdlib 3.11.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: {:DOWN, #Reference<0.1630123645.3685482498.192412>, :process, #PID<0.847.0>, {%DBConnection.OwnershipError{message: âcannot find ownership process for #PID<0.847.0>.\n\nWhen using ownership, you must manage connections in one\nof the four ways:\n\n* By explicitly checking out a connection\n* By explicitly allowing a spawned process\n* By running the pool in shared mode\n* By using :caller option with allowed process\n\nThe first two options require every new process to explicitly\ncheck a connection out or be allowed by calling checkout or\nallow respectively.\n\nThe third option requires a {:shared, pid} mode to be set.\nIf using shared mode in tests, make sure your tests are not\nasync.\n\nThe fourth option requires [caller: pid] to be used when\nchecking out a connection from the pool. The caller process\nshould already be allowed on a connection.\n\nIf you are reading this error, it means you have not done one\nof the steps above or that the owner process has crashed.\n\nSee Ecto.Adapters.SQL.Sandbox docs for more information.â}, [{Ecto.Adapters.SQL, :raise_sql_call_error, 1, [file: âlib/ecto/adapters/sql.exâ, line: 609]}, {Ecto.Adapters.SQL, :execute, 5, [file: âlib/ecto/adapters/sql.exâ, line: 545]}, {Ecto.Repo.Queryable, :execute, 4, [file: âlib/ecto/repo/queryable.exâ, line: 192]}, {EctoJob.Producer, :dispatch_jobs, 2, [file: âlib/ecto_job/producer.exâ, line: 184]}, {GenStage, :noreply_callback, 3, [file: âlib/gen_stage.exâ, line: 2103]}, {:gen_server, :try_dispatch, 4, [file: âgen_server.erlâ, line: 637]}, {:gen_server, :handle_msg, 6, [file: âgen_server.erlâ, line: 711]}, {:proc_lib, :init_p_do_apply, 3, [file: âproc_lib.erlâ, line: 249]}]}}
I have tried many ways to resolve this, but unable to succeed.
Please help me.