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

Simple way to check if a Connection is still alive.

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.4
    • Affects Version/s: 2.0.1
    • Component/s: None
    • Fully Compatible

      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

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

              Created:
              Updated:
              Resolved: