So I have this mix task that lasts for more than 1 hour.
When I run it, I get a (DBConnection.ConnectionError) client #PID<0.93.0> timed out because it queued and checked out the connection for longer than 60_000 seconds
.
I read, I can increase the timeout, though I can’t succeed in doing this only for the current mix task. I tried to set environment variables in my mix task, but apparently values are already initialized before the task’s run(args)
method is called.
- So I can I make a timeout task-specific?
But another solution would be to close the connection during the script, wouldn’t it?
It surprises me because in this script, I’d call indenpendant update
s like:
Repo.get(%struct{}, id) |> Struct.changeset(%{tada: true}) |> Repo.update()
I would expect this query to be commited in the DB, hence the connection can be closed after the Repo.update()
is called, but it apparently isn’t…
- Should I manually close and commit the query? Can I do this? Or am I leaving a connection open without being aware of it?
Thanks for support