Skip to content

Commit 33f67eb

Browse files
authored
Print ancestor in connection pool errors (#334)
1 parent 2512738 commit 33f67eb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/db_connection/connection_pool.ex

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ defmodule DBConnection.ConnectionPool do
352352

353353
defp drop(delay, from) do
354354
message = """
355-
connection not available and request was dropped from queue after #{delay}ms. \
355+
[#{ancestor()}] connection not available and request was dropped from queue after #{delay}ms. \
356356
This means requests are coming in and your connection pool cannot serve them fast enough. \
357357
You can address this by:
358358
@@ -369,6 +369,10 @@ defmodule DBConnection.ConnectionPool do
369369
Holder.reply_error(from, err)
370370
end
371371

372+
defp ancestor do
373+
Process.get(:"$ancestors", []) |> Enum.find(&is_atom/1)
374+
end
375+
372376
defp start_opts(opts) do
373377
Keyword.take(opts, [:name, :spawn_opt])
374378
end

0 commit comments

Comments
 (0)