ahav
I am reasonably new to elixir, and am trying to capture an error that stems from a query timing out. This code for this query is as follows:
Repo.all(query, [timeout: 5000])
with the “query” obviously being some form of Ecto.Query. This works great, I am just trying to handle if that query times out. If that query times out, it throws something similar to:
[error] MyXQL.Connection (#PID<0.676.0>) disconnected: ** (DBConnection.ConnectionError) client #PID<0.1508.0> timed out because it queued and checked out the connection for longer than 5000ms
Client #PID<0.1508.0> is still using a connection from owner at location:
:prim_inet.recv0/3
(myxql 0.2.10) lib/myxql/client.ex:171: MyXQL.Client.recv_packets/4
... (stacktrace)
The connection itself was checked out by #PID<0.1508.0> at location:
(ecto_sql 3.2.2) lib/ecto/adapters/sql.ex:570: Ecto.Adapters.SQL.execute!/4
... (stacktrace)
The trouble is, I am trying to wrap the Repo.all(query, [timeout: 5000]) in a try/rescue to catch when this error occurs, but it doesn’t appear to work when I am in tests. Is there a better way to handle this? There is no specific exception thrown, it is just labeled as an “error” as seen from the logs I wrote above.
Any help is greatly appreciated, let me know if I need to be more clear on anything!
Thanks! ![]()
Trending in Questions
Other Trending Topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #exunit
- #discussion
- #code-sync
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #ai
- #elixirconf-us
- #blog-post
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 1- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
bernardo
@ahav did you manage to solve it? Im facing the same situation here