-
Type: Improvement
-
Resolution: Won't Do
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
ObjectID takes a while to import because of these calls:
from random import SystemRandom ... class ObjectId: _pid = os.getpid() _inc = SystemRandom().randint(0, _MAX_COUNTER_VALUE) _inc_lock = threading.Lock() __random = _random_bytes()
It should be possible to defer some of these calls to the first time ObjectId is used.
Update: It's actually the from random import SystemRandom import which takes long time, not the SystemRandom() call itself.
- related to
-
PYTHON-4441 Lazy loading modules is not thread-safe
- Closed