-
-
Notifications
You must be signed in to change notification settings - Fork 130
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
Auto Retry (Idempotency requests) #462
Conversation
Build succeeded.
|
Build succeeded.
|
Build succeeded.
|
@idempotent ||= options[:idempotent].nil? ? false : !!options[:idempotent] | ||
@retry_interval ||= options[:retry_interval] ? options[:retry_interval] : 5 # Seconds | ||
@retry_limit ||= options[:retry_limit] ? options[:retry_limit] : 2 | ||
|
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.
Just a nit, but if I'm not mistaken, 3 lines above could be written in shorter way (also matching to pattern few lines bellow)
@idempotent ||= !!options[:idempotent]
@retry_interval ||= options[:retry_interval] || 5 # Seconds
@retry_limit ||= options[:retry_limit] || 2
Some test would be nice too..
Generally nice PR, overall looks good to me!
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.
That's neat.
Absolutely, I'lll looking into adding some tests
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.
@aufi, sorry didn't get the bandwidth to do it.
Build succeeded.
|
@gildub Hi Gilles, I know it is late, but I'm happy merging this PR when the https://github.com/fog/fog-openstack/pull/462/conflicts gets resolved. |
@aufi, Hi Marek, sorry for slow response. I've addressed conflict. Thanks! |
Build succeeded.
|
@aufi any chance to merge this into the master? The Swift service used by our company is pretty unreliable and this should solve that issue. |
@ShamoX this seems as a good and safe addition and ready to get in. Of course tests are missing, what is your preference here? |
Yes, tests are missing. I don't really see how we can tests this except by implementing a complexe request/response scenario, which seems not easy to implement with VCRs (maybe with a sort of interaction with doubles - but seems really complicated). Anyway, I can review it more precisely when I have more time and see if I can catch any statically analysable bad behaviours. But I doubt it. We should at least test new configuration variables to see if they are used. |
Auto Retry option for all services
Auto Retry is off by default but can be turned on with
:idempotent
option.Default values are
:retry_limit => 2
and:retry_interval => 5
(seconds)Only GET and DELETE REST verbs are used for auto retry. More verbs can be added if that make sense.
Addresses #453