-
Notifications
You must be signed in to change notification settings - Fork 39
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
Added a connection_timeout option and the related test case #50
base: master
Are you sure you want to change the base?
Added a connection_timeout option and the related test case #50
Conversation
When you call |
I will see if I can find a way to test this. The current test case is only there to test that the option is valid. I noticed that depending at which point in the initialization process the timeout append, postgres may throw an "incomplete startup packet" error. I have been inserting |
Yeah, it seems like too much bother to make an automated test for it. I'm just not familiar enough with the inner details of gen_server to know exactly what happens in this case. But it seems relevant to your use-case, because if PG is overloaded this could just make it more overloaded. (Though it seems promising that in your own case making this change worked out well.) |
@waisbrot Sorry haven't had time to work on this. Can I keep the PR open and I update it once I get an answer to your question? |
I don't have merge powers. Just fond of this library and hoping it's helpful if I review a bit. @pguyot seems at least somewhat active, but this is a pretty quiet repository so I doubt it's a big deal to leave it open. Especially when you're so diligent that you check in every couple weeks! |
I understand the issue is that the supervisor's mailbox is full because opening connections takes too much time. Adding a timeout on What do you think about moving the open logic out of |
@pguyot Sounds good to me. As I mentioned above, I might not be able to start right way but if nobody else has an immediate need for this fix I would be interested to work on it. |
I did some modifications already and I am wondering if I should keep the timeout where it is or move it down to the tcp:connect/3 in pgsql_open/1. It would automatically apply to connections and reconnections. But in an other hand I am afraid that, in some cases, the connection hang higher up, during the communication with postgres not when the tcp connection is being established. |
Related to #49.
I don't know if the lists:keytake/3 is necessary here might rewrite it with a lists:keyfind/3 instead.