File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1319,8 +1319,9 @@ defmodule Ecto.Repo do
13191319 are already loaded. By setting this option to true, any existing
13201320 association will be discarded and reloaded.
13211321 * `:in_parallel` - If the preloads must be done in parallel. It can
1322- only be performed when we have more than one preload and the
1323- repository is not in a transaction. Defaults to `true`.
1322+ only be performed when we have more than one preload, the repository
1323+ is not in a transaction, and the machine has more than one scheduler.
1324+ Defaults to `true`.
13241325 * `:prefix` - the prefix to fetch preloads from. By default, queries
13251326 will use the same prefix as the first struct in the given collection.
13261327 This option allows the prefix to be changed.
Original file line number Diff line number Diff line change @@ -151,7 +151,7 @@ defmodule Ecto.Repo.Preloader do
151151 # Then we execute queries in parallel
152152 defp maybe_pmap ( preloaders , _repo_name , { adapter_meta , opts } ) do
153153 if match? ( [ _ , _ | _ ] , preloaders ) and not adapter_meta . adapter . checked_out? ( adapter_meta ) and
154- Keyword . get ( opts , :in_parallel , true ) do
154+ Keyword . get ( opts , :in_parallel , true ) and System . schedulers_online ( ) > 1 do
155155 # We pass caller: self() so the ownership pool knows where
156156 # to fetch the connection from and set the proper timeouts.
157157 # Note while the ownership pool uses '$callers' from pdict,
You can’t perform that action at this time.
0 commit comments