-
Notifications
You must be signed in to change notification settings - Fork 105
GCI604 [Team ELAN][2025] - Changelog add rule #397
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "title": "limit retry", | ||
| "type": "CODE_SMELL", | ||
| "status": "ready", | ||
| "remediation": { | ||
| "func": "Constant/Issue", | ||
| "constantCost": "5min" | ||
| }, | ||
| "tags": [ | ||
| "sobriety", | ||
| "environment", | ||
| "creedengo", | ||
| "spring-boot", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not only for spring-boot but also for "spring" |
||
| "eco-design" | ||
| ], | ||
| "defaultSeverity": "Major" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| Spring Retry: Inconsistent configuration | ||
| = Inconsistent Spring Retry Configuration | ||
|
|
||
| An inconsistent configuration of Spring Retry can lead to blocking threads and increased energy usage. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you please add some references like :
if we respect our process for a new rule ... we have to give evidence to prove that its a good idea like :
|
||
|
|
||
| With Spring Retry, you can mark operations as retryable using `@Retryable`. However, misconfiguration (e.g., too many retries or long backoff periods) can block threads unnecessarily — consuming CPU cycles and energy. | ||
|
|
||
| This rule applies to usages of `@Retryable` only. | ||
| A threshold `max.timeout` defines the maximum acceptable blocking time (in milliseconds). | ||
|
|
||
| `max.timeout=50000` | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what is the good value for max timeout ? maybe also describe de "maxDelay" parameter |
||
|
|
||
| == Noncompliant Code Example | ||
|
|
||
| [source,java] | ||
| ---- | ||
| @Retryable(maxAttempts = 4, backoff = @Backoff(delay = 10, multiplier = 100)) | ||
| void retryService(String sql); | ||
| ---- | ||
|
|
||
| In this example, retry delays compound to a total retry time of over 10,000,000 ms (10,000 seconds), which exceeds the `max.timeout` threshold. | ||
|
|
||
| == Compliant Solution | ||
|
|
||
| [source,java] | ||
| ---- | ||
| @Retryable(maxAttempts = 5, backoff = @Backoff(delay = 10)) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe give some other compliant examples with acceptable "multiplier" or the "maxDelay" given to limit the maximum timeout |
||
| void retryService(String sql); | ||
| ---- | ||
|
|
||
| This configuration limits the total blocking time to 50 ms (5 attempts × 10 ms), keeping energy usage efficient and thread usage minimal. | ||
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.
please change the title to something more explicit