-
Notifications
You must be signed in to change notification settings - Fork 1.1k
PYTHON-5344 and PYTHON-5403 Allow Instantiated MongoClients to Send Client Metadata On-Demand #2358
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
base: master
Are you sure you want to change the base?
Conversation
pymongo/asynchronous/mongo_client.py
Outdated
@@ -1040,6 +1041,20 @@ async def target() -> bool: | |||
self._kill_cursors_executor = executor | |||
self._opened = False | |||
|
|||
def _append_metadata(self, driver_info: DriverInfo) -> None: |
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.
I think this needs to be public: "Specifies that drivers MUST provide an API to allow updating client metadata (name, version, platform) after initialization"
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.
oh good catch!
) | ||
|
||
# Generate unified tests. | ||
globals().update(generate_test_classes(_TEST_PATH, module=__name__, RUN_ON_SERVERLESS=True)) |
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.
We don't test on serverless anymore, so you can remove RUN_ON_SERVERLESS
.
@@ -703,6 +704,7 @@ async def _collectionOperation_createChangeStream(self, target, *args, **kwargs) | |||
async def _databaseOperation_runCommand(self, target, **kwargs): | |||
self.__raise_if_unsupported("runCommand", target, AsyncDatabase) | |||
# Ensure the first key is the command name. | |||
print(kwargs) |
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.
there's several print statements left in this file
) -> None: | ||
# send initial metadata | ||
name, version, platform, metadata = await self.send_ping_and_get_metadata(client, True) | ||
await asyncio.sleep(0.005) |
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.
Why this specific sleep? Is this a potential source of flakiness?
https://jira.mongodb.org/browse/PYTHON-5344
https://jira.mongodb.org/browse/PYTHON-5403 (ticket for async tests)
Notes:
test/mockupdb
) to utilize synchro for the async -> sync tests.