Skip to content

Commit 2821566

Browse files
committed
Fix import of _PYMONGO_EXECUTOR
1 parent 076a014 commit 2821566

File tree

4 files changed

+27
-3
lines changed

4 files changed

+27
-3
lines changed

pymongo/_asyncio_executor.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Copyright 2024-present MongoDB, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
"""A separate ThreadPoolExecutor instance used internally to avoid competing for resources with the default asyncio ThreadPoolExecutor
16+
that user code will use."""
17+
18+
from __future__ import annotations
19+
20+
from concurrent.futures import ThreadPoolExecutor
21+
22+
_PYMONGO_EXECUTOR = ThreadPoolExecutor(thread_name_prefix="PYMONGO_EXECUTOR-")

pymongo/asynchronous/pool.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
)
3939

4040
from bson import DEFAULT_CODEC_OPTIONS
41-
from pymongo import _PYMONGO_EXECUTOR, _csot, helpers_shared
41+
from pymongo import _csot, helpers_shared
42+
from pymongo._asyncio_executor import _PYMONGO_EXECUTOR
4243
from pymongo.asynchronous.client_session import _validate_session_write_concern
4344
from pymongo.asynchronous.helpers import _handle_reauth
4445
from pymongo.asynchronous.network import command, receive_message

pymongo/pyopenssl_context.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
from OpenSSL import SSL as _SSL
3232
from OpenSSL import crypto as _crypto
3333

34-
from pymongo import _PYMONGO_EXECUTOR
34+
from pymongo._asyncio_executor import _PYMONGO_EXECUTOR
3535
from pymongo.errors import ConfigurationError as _ConfigurationError
3636
from pymongo.errors import _CertificateError # type:ignore[attr-defined]
3737
from pymongo.ocsp_cache import _OCSPCache

pymongo/synchronous/pool.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
)
3939

4040
from bson import DEFAULT_CODEC_OPTIONS
41-
from pymongo import _PYMONGO_EXECUTOR, _csot, helpers_shared
41+
from pymongo import _csot, helpers_shared
42+
from pymongo._asyncio_executor import _PYMONGO_EXECUTOR
4243
from pymongo.common import (
4344
MAX_BSON_SIZE,
4445
MAX_MESSAGE_SIZE,

0 commit comments

Comments
 (0)