Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-275

Simple way to check if a Connection is still alive.

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: 2.0.1
    • Fix Version/s: 2.4
    • Component/s: None
    • Labels:
    • Backwards Compatibility:
      Fully Compatible

      Description

      It will be useful to have a simple and cheap way to check if a Connection object can still see any of the MongoDB nodes. By cheap I mean without actually doing any requests, just checking if any of the sockets is still open would be good enough.

      An example implementation:

      class Connection(common.BaseObject):

      def alive(self):
      try:
      if self.__socket() != None:
      return True
      except Exception:
      pass
      return False

        Attachments

          Activity

            People

            Assignee:
            jesse A. Jesse Jiryu Davis
            Reporter:
            unbeknownst unbeknownst
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: