Improve stale socket calculation by recording when it's checked into a pool

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • 3.5
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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.

            Assignee:
            Shane Harvey
            Reporter:
            Emily Stolfo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: