-
Notifications
You must be signed in to change notification settings - Fork 107
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
Improves tolerance of db connection failures in pulpcore-content #1701
Conversation
Attached issue: https://pulp.plan.io/issues/9515 |
293a8ae
to
ce16351
Compare
[noissue]
462de31
to
37b5dab
Compare
This patch moves Handler._reset_db_connection() call to get_base_paths_blocking(). This ensures that the connection is reset inside the same thread that is used to perform ORM calls. This fixes a bug where the /pulp/content/ page would return a 500 error after the connection the database is closed due to a network problem or a database restart. A call to Handler._reset_db_connection() has also been added to the _heartbeat() co-routine. This ensures that the heartbeat continues to be recorded in the database even if the db connection was closed. fixes: #9515 https://pulp.plan.io/issues/9515
class MockException(Exception): | ||
pass | ||
|
||
mock_get_or_create.side_effect = [InterfaceError(), OperationalError(), MockException()] |
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 triplet!
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.
👍 Thanks!
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.
🎉
This patch moves Handler._reset_db_connection() call to get_base_paths_blocking(). This ensures that the
connection is reset inside the same thread that is used to perform ORM calls. This fixes a bug where the
/pulp/content/ page would return a 500 error after the connection the database is closed due to a network
problem or a database restart.
A call to Handler._reset_db_connection() has also been added to the _heartbeat() co-routine. This ensures
that the heartbeat continues to be recorded in the database even if the db connection was closed.
fixes: #9515
https://pulp.plan.io/issues/9515