Hi,
My team is developing an application that must integrate with another 3rd party system and I am making a simulator for the 3rd party system in Phoenix.
One of the integration use cases that our application must handle is when we make API requests from our app to which the 3rd party system is responding slow (in a couple of minutes).
While processing a request of this type, the Phoenix simulator I am writing is making a large DB transaction (it inserts many rows in one MariaDB table). The problem that I am facing is that after exactly one minute, the transaction fails with the following error message:
[error] Mariaex.Protocol (#PID<0.nnn.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.mmm.0> exited
In the test environment, I could solve the problem (i.e. make a ExUnit test that calls a request which makes a DB transaction longer than one minute) by adding the @tag timeout: 120_000
to the test case and by passing ownership_timeout: 120_000
option to the Ecto.Adapters.SQL.Sandbox.checkout
function call.
However in the dev / prod environment I could not find a way to increase the timeout of the transaction, even if I set timeout: 120_000
option to the Repo configuration. It seems that in the test env the DB connection pool implementation is different than the “normal” connection pool. Can you please direct me to what am I missing?
Thanks.
P.S. I am pretty new to Phoenix and Elixir, but I love it.