Added update_timeout API to reconfigure timeouts on the fly #302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?