Skip to content

Commit

Permalink
More docs related to transactions and sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jun 1, 2022
1 parent 2055ffc commit f534996
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/ecto/repo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,14 @@ defmodule Ecto.Repo do
transaction won't be part of the same transaction and will use a separate
connection altogether.
When using the the `Ecto.Adapters.SQL.Sandbox` in tests, while it may be
possible to share the connection between processes, the parent process
will typically hold the connection until the transaction completes. This
may lead to a deadlock if the child process attempts to use the same connection.
See the docs for
[`Ecto.Adapters.SQL.Sandbox`](https://hexdocs.pm/ecto_sql/Ecto.Adapters.SQL.Sandbox.html)
for more information.
## Options
See the ["Shared options"](#module-shared-options) section at the module
Expand All @@ -1842,10 +1850,6 @@ defmodule Ecto.Repo do
return true inside transactions explicitly created with `transaction/2`. This
is done so the test environment mimics dev and prod.
If you are trying to debug transaction-related code while using
`Ecto.Adapters.SQL.Sandbox`, it may be more helpful to configure the database
to log all statements and consult those logs.
## Examples
MyRepo.in_transaction?
Expand Down

0 comments on commit f534996

Please sign in to comment.