Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@giangbui
Copy link
Contributor

Description about what this pull request does.

Add timeout and retry logic for all requests made to indexd api

Please make sure to follow the DEV guidelines before asking for review.

New Features

Add timeout and retry logic for all requests made to indexd api

Breaking Changes

Bug Fixes

Improvements

Dependency updates

Deployment changes

@giangbui giangbui requested a review from a team as a code owner March 20, 2019 15:38

def indexd_request_wrapper(func):
def retry_logic_with_timeout(*args, **kwargs):
kwargs.update({"timeout": 60})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean to use set_default()? The update here overwrites any given timeout.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Thanks!

return resp

@indexd_request_wrapper
def _post(self, *path, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still having concerns adding retries on POST, PUT or DELETE - it is totally fine to add timeouts, but retrying means any future IndexD APIs must be strictly repeatable (calling with the same args for more than one times ends up with identical results), if current APIs are already repeatable. What was the initial motivation to retry on e.g. POST please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a ticket to copy and index million files. We have to make sure that all the new files need to be indexed in indexd. For safety, I think I will only add timeout for POS, PUT and DELETE and change the logic in my code. Thank you for your comment!
Fixed in 5f39c8b

@giangbui giangbui force-pushed the feat/timeout_retry branch from f108389 to 5f39c8b Compare March 26, 2019 17:05
Copy link
Contributor

@fantix fantix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@giangbui giangbui merged commit 3493bcb into master Mar 26, 2019
@m0nhawk m0nhawk deleted the feat/timeout_retry branch August 14, 2019 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants