Skip to content

Commit a703c2e

Browse files
authored
Label the sandbox owner process (elixir-ecto#697)
1 parent ece0391 commit a703c2e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lib/ecto/adapters/sql/sandbox.ex

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,7 @@ defmodule Ecto.Adapters.SQL.Sandbox do
450450

451451
{:ok, pid} =
452452
Agent.start(fn ->
453+
set_label({:sql_sandbox_owner, %{started_by: parent}})
453454
{shared, opts} = Keyword.pop(opts, :shared, false)
454455
:ok = checkout(repo, opts)
455456

@@ -702,4 +703,12 @@ defmodule Ecto.Adapters.SQL.Sandbox do
702703
defp pre_checkin(_, Connection, {conn_mod, conn_state, _in_transaction?}, _opts) do
703704
{:ok, conn_mod, conn_state}
704705
end
706+
707+
defp set_label(label) do
708+
if function_exported?(Process, :set_label, 1) do
709+
Process.set_label(label)
710+
end
711+
712+
:ok
713+
end
705714
end

0 commit comments

Comments
 (0)