Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Changed

Contributed by @ericreeves.

* update db connect mongo connection test - `isMaster` MongoDB command depreciated, switch to `hello` #5302
* update db connect mongo connection test - `isMaster` MongoDB command depreciated, switch to `ping` #5302, #5341

Contributed by @lukepatrick

Expand Down
6 changes: 3 additions & 3 deletions st2common/st2common/models/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ def _db_connect(
# successfully established.
# See http://api.mongodb.com/python/current/api/pymongo/mongo_client.html for details
try:
# The hello command is cheap and does not require auth
# https://docs.mongodb.com/v4.4/reference/command/hello/
connection.admin.command("hello")
# The ping command is cheap and does not require auth
# https://www.mongodb.com/community/forums/t/how-to-use-the-new-hello-interface-for-availability/116748/
connection.admin.command("ping")
except (ConnectionFailure, ServerSelectionTimeoutError) as e:
# NOTE: ServerSelectionTimeoutError can also be thrown if SSLHandShake fails in the server
# Sadly the client doesn't include more information about the error so in such scenarios
Expand Down