-
Notifications
You must be signed in to change notification settings - Fork 0
Implement retry, backoff #5
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
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0eadf31
Refactor ChatService to separate LLM response handling
codebyNorthsteep 26f669b
Implement retry and circuit breaker for external service calls in Cha…
codebyNorthsteep cfe26ae
Merge branch 'main' into feature/implement-retry-backoff
codebyNorthsteep 91e0dfd
Refactor ChatService and configuration for retry and circuit breaker …
codebyNorthsteep f6d860e
Add unit test for retry mechanism in ChatService when LLM service is …
codebyNorthsteep ff70956
Introduce `RetryableHttpException` and refactor exception handling fo…
codebyNorthsteep 01b1e40
Add unit test for Circuit Breaker logic in ChatService to validate fa…
codebyNorthsteep 96925bc
Add `@Slf4j` annotation to ChatService and improve retry configuratio…
codebyNorthsteep d930cfa
Prevent adding fallback messages to chat history in ChatService and u…
codebyNorthsteep 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
19 changes: 16 additions & 3 deletions
19
src/main/java/org/example/projectbifrost/configuration/RestClientConfiguration.java
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
7 changes: 7 additions & 0 deletions
7
src/main/java/org/example/projectbifrost/exception/RetryableHttpException.java
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,7 @@ | ||
| package org.example.projectbifrost.exception; | ||
|
|
||
| public class RetryableHttpException extends RuntimeException { | ||
| public RetryableHttpException(String message) { | ||
| super(message); | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -1,4 +1,19 @@ | ||
| spring.application.name=ProjectBifrost | ||
| spring.mvc.problemdetails.enabled=true | ||
| openrouter.api.key=${OPENROUTER_API_KEY} | ||
| openrouter.base-url=https://openrouter.ai/api/v1 | ||
| openrouter.model=poolside/laguna-xs.2:free | ||
|
|
||
| resilience4j.circuitbreaker.instances.chatService.sliding-window-size=10 | ||
| resilience4j.circuitbreaker.instances.chatService.minimum-number-of-calls=5 | ||
| resilience4j.circuitbreaker.instances.chatService.failure-rate-threshold=50 | ||
|
|
||
| resilience4j.circuitbreaker.instances.chatService.wait-duration-in-open-state=5s | ||
| resilience4j.retry.instances.chatService.max-attempts=3 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| resilience4j.retry.instances.chatService.retry-exceptions=org.example.projectbifrost.exception.RetryableHttpException | ||
| resilience4j.retry.instances.chatService.wait-duration=500ms | ||
| resilience4j.retry.instances.chatService.enable-exponential-backoff=true | ||
| resilience4j.retry.instances.chatService.exponential-backoff-multiplier=2 | ||
| resilience4j.circuitbreaker.circuitBreakerAspectOrder=1 | ||
| resilience4j.retry.retryAspectOrder=2 | ||
| logging.level.io.github.resilience4j=DEBUG | ||
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.