Shane
(Shane Harvey)
7
@Rapha_Ben we can reproduce the fork warning. We recommend you add connect=False when creating the client and ensure the client is only used within the request handler (eg don’t run client.server_info() or client.admin.command() at the global level):
client = MongoClient(uri, tls=True, tlsCAFile=certifi.where(), tlsCertificateKeyFile='secret/X509-cert.pem', server_api=ServerApi('1'), tz_aware=True, connect=False)
Could you confirm whether this fixes the warnings and ServerSelectionTimeouts you’re seeing? If not, could you try downgrading to pymongo 4.7?
We will update the docs to mention this. Thanks for reporting.