-
Notifications
You must be signed in to change notification settings - Fork 114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proxy info messages to the adapter #316
Conversation
4cfe097
to
ba7677a
Compare
@@ -333,11 +333,11 @@ defmodule DBConnection.Connection do | |||
def handle_event(:info, msg, :no_state, %{mod: mod, state: state} = s) do | |||
if function_exported?(mod, :handle_info, 2) do | |||
case apply(mod, :handle_info, [msg, state]) do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still passing the state to the callback since the monitor ref / socket ref would be there, and they are probably needed to match on the incoming message.
def handle_info({:DOWN, _ref, _type, sock, _info}, {sock, _buffer} = s) do | ||
{:disconnect, TCPConnection.Error.exception({:idle, :closed}), s} | ||
def handle_info({:DOWN, _ref, _type, sock, _info}, {sock, _buffer}) do | ||
{:disconnect, TCPConnection.Error.exception({:idle, :closed})} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like here.
|
||
assert_receive {:connected, conn} | ||
send(conn, "some harmless message") | ||
assert P.run(pool, fn _ -> :result end) == :result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using this just to "sync" with the connection process, i.e. wait until it has processed all the messages. Maybe there is a better way? I know some people use :sys.get_state/1
(e.g. :sys.get_state(conn)
in this case) but don't know if it's any better.
💚 💙 💜 💛 ❤️ |
Seems like I forgot to run formatter on |
I just did it in main, no worries. But we also forgot to document |
Sure! |
Hm... I tried
I'll look into it more tomorrow, but first thought is ETS holds onto the old conn for some reason and checkout happens before pool_update(new_state) even though connection completes before the checkout. It might be time to finally learn how DBConnection does its magic :) UPDATE: It seems like the ETS table is not updated on disconnect, so the very next query gets a stale conn. |
It doesn't seem like Should I revert this PR? |
@ruslandoga it is up to you. Couldn't we allow |
ReqCH gave me an idea that maybe DBConnection is not necessary for a ClickHouse client. And it doesn't seem like any other adapter needs a Sorry! |
This reverts commit 5d088f7.
Context: #315 (comment)