generated from neutrons/python_project_template
-
Notifications
You must be signed in to change notification settings - Fork 0
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 logic for database and broker connections #12
Merged
Conversation
This file contains 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
Enhanced `connect_to_database` and `connect_to_broker` functions to include retry logic with specified attempts and intervals. Updated corresponding unit tests to verify the new functionality and handle connection failures gracefully. Signed-off-by: Jose Borreguero <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## next #12 +/- ##
==========================================
+ Coverage 89.51% 92.95% +3.44%
==========================================
Files 3 3
Lines 124 142 +18
==========================================
+ Hits 111 132 +21
+ Misses 13 10 -3 ☔ View full report in Codecov by Sentry. |
Signed-off-by: Jose Borreguero <[email protected]>
Signed-off-by: Jose Borreguero <[email protected]>
Added print statements to log successful connections in both PostgreSQL and broker connection attempts. This will aid in debugging and confirming when connections are successfully established. Signed-off-by: Jose Borreguero <[email protected]>
Introduce deployment workflow section in the docs with an accompanying image. This includes details on deploying Webmonchow as a service in a Docker container environment. Signed-off-by: Jose Borreguero <[email protected]>
Update the documentation to include specific URLs for the local and test environments of the Web Monitor application. This provides clearer guidance on accessing the Webmonchow service in different deployment contexts. Signed-off-by: Jose Borreguero <[email protected]>
Removed unnecessary reassignment of 'conn' in the connection attempt loop. This change cleans up the code by ensuring 'conn' is only connected without reassigning it unnecessarily. Signed-off-by: Jose Borreguero <[email protected]>
backmari
approved these changes
Aug 30, 2024
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.
Good addition with retry logic 🙌
@backmari thanks for the review! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of the changes
When
testfixture01
is deployed in the test environment ofwebmonchow
, there's no guarantee that neither the AMQ broker or the Webmon database servers have deployed. Because of this reason,webmonchow
will retry (every 5 seconds by default) to connect to these services, in the hope that they will eventually run.Check all that apply:
Added integration testsReferences:
Manual test for the reviewer
Deploy WebMon locally in your machine, but edit Dockerfile.webmonchow so that instead of using the webmonchow conda package, it will use the webmonchow feature branch
relentless_attempt_db_connection
. The edited Dockerfile:Check list for the reviewer