-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add retry mechanism for Azure service bus #6276
Add retry mechanism for Azure service bus #6276
Conversation
...cation/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java
Outdated
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev-2.x #6276 +/- ##
=============================================
+ Coverage 69.74% 69.78% +0.03%
- Complexity 17729 17760 +31
=============================================
Files 2010 2011 +1
Lines 75918 76015 +97
Branches 7775 7791 +16
=============================================
+ Hits 52948 53044 +96
- Misses 20260 20262 +2
+ Partials 2710 2709 -1 ☔ View full report in Codecov by Sentry. |
...cation/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java
Show resolved
Hide resolved
...cation/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java
Outdated
Show resolved
Hide resolved
...cation/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java
Show resolved
Hide resolved
...cation/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java
Show resolved
Hide resolved
...cation/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java
Outdated
Show resolved
Hide resolved
...cation/src/ext/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdater.java
Outdated
Show resolved
Hide resolved
...c/ext-test/java/org/opentripplanner/ext/siri/updater/azure/AbstractAzureSiriUpdaterTest.java
Outdated
Show resolved
Hide resolved
As mentioned during the developer meeting, you can have a look to |
915a7dd
to
718b738
Compare
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.
The non-sandbox changes look fine.
51f004c
into
opentripplanner:dev-2.x
Summary
This PR refactors the retry logic in
AbstractAzureSiriUpdater
into a reusable method,executeWithRetry
, which is now applied consistently for retries. The updated method includes handling of retriable and non-retriable exceptions to ensure retries occur only when appropriate. Accompanying unit tests validate the behavior and correctness of this refactored retry mechanism.Issue
Motivation:
How the Code Works:
executeWithRetry
encapsulates retry logic with an exponential backoff strategy, capping retries at a maximum interval of 60 seconds.shouldRetry
method to differentiate between retriable and non-retriable exceptions, improving robustness and avoiding unnecessary retries.Technical Considerations:
This PR is linked to Skånetrafiken issue #90238
Unit Tests
Unit tests in
AbstractAzureSiriUpdaterTest
validate:shouldRetry
method.sleep
to simulate retry behavior without introducing delays during testing.Manual verification confirmed the retry mechanism works in practical scenarios, though it is challenging to simulate all possible exceptions live.
All unit tests pass.
Documentation
executeWithRetry
and its reliance onshouldRetry
for exception classification.Changelog
Added:
AbstractAzureSiriUpdater
into a reusable method (executeWithRetry
) for consistent application across critical operations.shouldRetry
method to distinguish retriable and non-retriable failures.AbstractAzureSiriUpdaterTest
to validate the retry logic and backoff behavior.Bumping the Serialization Version ID
No changes were made to the graph serialization format; therefore, no serialization version bump is necessary.