-
Notifications
You must be signed in to change notification settings - Fork 33
Add retry support #1925
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
Merged
Merged
Add retry support #1925
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
19c7a19
Adding retry config
HantingZhang2 bfcdd61
Implement retry logic
HantingZhang2 f5a8069
correct millis
HantingZhang2 d65da68
add default to retry config
HantingZhang2 fb23a96
change retry interval calculation
HantingZhang2 b331730
first test iteration
HantingZhang2 f73f609
pre-commit fixes
c336631
Using apiclient With Retry
HantingZhang2 c5f2680
Merge branch 'hantingz/add-retry' of github.com:DataDog/datadog-api-c…
HantingZhang2 ef4a9b5
pre-commit fixes
4caf8ba
Add retry test cassette
HantingZhang2 e692c77
pre-commit fixes
864c584
add generator code
HantingZhang2 dd5b81c
pre-commit fixes
5f3aaef
Add retryconfig back
HantingZhang2 b470314
pre-commit fixes
092528f
Update ReadMe
HantingZhang2 7daa698
pre-commit fixes
0fe83c5
Add RetryConfig in generator file item
HantingZhang2 b3c4c2b
Merge branch 'hantingz/add-retry' of github.com:DataDog/datadog-api-c…
HantingZhang2 0d450ef
Merge branch 'master' into hantingz/add-retry
HantingZhang2 57dec22
add retryConfig back
HantingZhang2 e35b275
pre-commit fixes
474db21
fix function name
HantingZhang2 0aa6aa3
Add cassette for status code 500 test
HantingZhang2 30dbb8d
Add enable retry method on the client
HantingZhang2 d952594
pre-commit fixes
0c13e0a
update retryConfig object and test casettes
HantingZhang2 1478c67
pre-commit fixes
d2cf66c
Refactor tests and retry config
HantingZhang2 9e1b705
pre-commit fixes
b664dd8
change test assert
HantingZhang2 e27c5e3
add back sleep method using retry object
HantingZhang2 caa432b
pre-commit fixes
ae5600c
refresh jdoc
HantingZhang2 533fb45
pre-commit fixes
4352fc2
Remove param for jdoc
HantingZhang2 a913feb
pre-commit fixes
9aef306
Add mock retry config and simplify the sleep
HantingZhang2 999073d
pre-commit fixes
5f4938f
fix for comments
HantingZhang2 dcdd922
pre-commit fixes
a511cc8
refactor retry test
HantingZhang2 1e0adb7
pre-commit fixes
dd420ec
Rearrange mockconfig
HantingZhang2 e18d64a
pre-commit fixes
858d2ce
Merge branch 'master' into hantingz/add-retry
therve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| {% include "ApiInfo.j2" %} | ||
|
|
||
| package {{ common_package_name }}; | ||
|
|
||
| public class RetryConfig { | ||
| public boolean enableRetry; | ||
| public int backOffMultiplier; | ||
| public int backOffBase; | ||
| public int maxRetries; | ||
|
|
||
| /** | ||
| * @param enableRetry Enable retry when rate limited | ||
| * @param backOffMultiplier Multiplier for retry backoff | ||
| * @param backOffBase Base for retry backoff | ||
| * @param maxRetries Maximum number of retries | ||
| */ | ||
| public RetryConfig(boolean enableRetry, int backOffMultiplier, int backOffBase, int maxRetries) { | ||
| this.enableRetry = enableRetry; | ||
| this.backOffMultiplier = backOffMultiplier; | ||
| this.backOffBase = backOffBase; | ||
| this.maxRetries = maxRetries; | ||
| } | ||
|
|
||
| public boolean isEnableRetry() { | ||
| return enableRetry; | ||
| } | ||
|
|
||
| public int getBackOffMultiplier() { | ||
| return backOffMultiplier; | ||
| } | ||
|
|
||
| public int getBackOffBase() { | ||
| return backOffBase; | ||
| } | ||
|
|
||
| public int getMaxRetries() { | ||
| return maxRetries; | ||
| } | ||
|
|
||
| public void setEnableRetry(boolean enableRetry) { | ||
| this.enableRetry = enableRetry; | ||
| } | ||
|
|
||
| public void setBackOffMultiplier(int backOffMultiplier) { | ||
| this.backOffMultiplier = backOffMultiplier; | ||
| } | ||
|
|
||
| public void setBackOffBase(int backOffBase) { | ||
| this.backOffBase = backOffBase; | ||
| } | ||
|
|
||
| public void setMaxRetries(int maxRetries) { | ||
| this.maxRetries = maxRetries; | ||
| } | ||
|
|
||
| public void sleepInterval(int sleepInterval) { | ||
| try { | ||
| Thread.sleep(sleepInterval * 1000); | ||
| } catch (InterruptedException e) { | ||
| Thread.currentThread().interrupt(); | ||
| e.printStackTrace(); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.