-
Type: Improvement
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
I see that the last_checkout attribute of a socket is set when it’s checked out from the pool and is later used to calculate its age. This seems like a misleading name for this option then, as the socket is only idle when it is done being used.
The last_checkout value is set before it’s used so the “idle time” includes its “in use time”. https://github.com/mongodb/mongo-python-driver/blob/master/pymongo/pool.py#L844
It seems that the idle time should be calculated using the time at which the socket is returned to the pool.