File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change 79
79
80
80
_IS_SYNC = True
81
81
82
+ # The default asyncio loop implementation on Windows
83
+ # has issues with sharing sockets across loops (https://github.com/python/cpython/issues/122240)
84
+ # We explicitly use a different loop implementation here to prevent that issue
85
+ if not _IS_SYNC and sys .platform == "win32" :
86
+ asyncio .set_event_loop_policy (asyncio .WindowsSelectorEventLoopPolicy ())
87
+
82
88
83
89
class ClientContext :
84
90
client : MongoClient
Original file line number Diff line number Diff line change 79
79
80
80
_IS_SYNC = False
81
81
82
+ # The default asyncio loop implementation on Windows
83
+ # has issues with sharing sockets across loops (https://github.com/python/cpython/issues/122240)
84
+ # We explicitly use a different loop implementation here to prevent that issue
85
+ if not _IS_SYNC and sys .platform == "win32" :
86
+ asyncio .set_event_loop_policy (asyncio .WindowsSelectorEventLoopPolicy ())
87
+
82
88
83
89
class AsyncClientContext :
84
90
client : AsyncMongoClient
You can’t perform that action at this time.
0 commit comments