Closed dmorneau closed 5 years ago
Ah this would only work when using the previous poolboy pool, other pools would error. It was unintentional and this is bad practice on poolboy side as the reply was causing incorrect client behavior. We can definitely provide a better error but it would be raising as something has gone very wrong when call this with the wrong pool.
The way to solve this in Ecto is to pass caller: parent_pid
to the repo calls in the spawned process. This will handle allow without requiring an explicit call.
I will improve this error on the ecto side of things. But yes, this is not supported behaviour. We will instead raise a better error message!
Environment
Current behavior
After upgrading my application to db_connection-2.0.1 and ecto_sql-3.0.0, this code in a Phoenix controller started failing:
The error says:
and
I noticed the same error happening in all tests if I run this command in the
db_connection
repo:Expected behavior
I would expect the code to work as it did previously, i.e. the
Sandbox.allow
call would be a no-op when not using the sandbox (not running tests) rather than cause a crash.If that's not allowed anymore that's fine too, but I figured I would ask first, the error message is rather confusing.