Error in async queries

I try do many async queries :

def myQuery (symbol) do
" myQuery with #{symbol} … "

[“AAA”,“BBB”, … ]
|> (fn symbol -> Task.async(fn -> Ecto.Adapters.SQL.query!(MyRepo.Repo, myQuery(symbol)) end ) end )

But I’ve got error :
[error] Task #PID<0.11971.0> started from #PID<0.11412.0> terminating

** (stop) exited in:, {:checkout,#Reference<0.2936218770.3260547073.261662>, true}, 5000)

** (EXIT) time out

What should I change to avoid error ?

Thanks for answer .

Don’t spam your database with that many queries.

There have to be that much, as it seems that they pile up in a way that eventually some of the requests die because they have to wait for the connection pool longer than 5 seconds.

You need to rate limit them or increase the pool timeout, but that will probably just postpone the problem.

1 Like