Added update_timeout API to reconfigure timeouts on the fly#302
Added update_timeout API to reconfigure timeouts on the fly#302
Conversation
ad29f21 to
c2b1e35
Compare
|
This seems like a one-off solution for the issue of timeouts when grabbing a connection from a connection pool. It'd be nice if there were a more general solution to this problem. We can just solve cases like this as they crop up, but the intended goal of the chaining API was to be stateless. Perhaps we can abstract configuration overrides like this into a context object that can get passed in per-request? |
|
How many options do you really need to dynamically override though? If you're assuming it's a connection pool you only really are going to toggle cookies/timeouts and that's about it. |
|
At least these three should be configurable:
👍 on idea of context. |
|
Hrm, maybe something like |
|
I think #306 ( |
This is silly... and well that's about it, but I can't see a better way of doing it so I think it's known silly? I think this is a legitimate use case, but I can't share the code since it's one of our internal gems.
We have a S2S library, two of the main features are it uses a connection pool + conn reuse, and the other is that you can dynamically reconfigure timeouts. Eg, use a short timeout for primary key lookup APIs but a long timeout for search APIs.
We want to share the same pool between the two because the SSL handshake is expensive. We can't do that with what we have today in HTTP.rb, since we also need to reconfigure the socket when the timeout changes.
Currently we do it with
instance_variable_get, but I'd obviously prefer not to rely on that for longer term. You could make a case that we might want a more generalized way of reconfiguring, but I think timeout is the 99% use case where you want to keep the same socket but change someting.Thoughts?