code: def run(self):
          
          retries = 0
          try:
              while not self._stopping:
                  try:
                      data = self.notifications_api.long_poll_notifications()
                  except mds.rest.ApiException as e:
                      # An HTTP 410 can be raised when stopping so don't log anything
                      if not self._stopping:
                          backoff = 2 ** retries - random.randint(int(retries / 2), retries)
                          LOG.error('Notification long poll failed with exception (retry in %d seconds):\n%s', backoff, e)
                          retries += 1
                          # Backoff for an increasing amount of time until we have tried 10 times, then reset the backoff.
                          if retries >= 10:
                              retries = 0
                          time.sleep(backoff)
                  else:
                      handle_channel_message(
                          db=self.db,
                          queues=self.queues,
                          b64decode=self._b64decode,
                          notification_object=data
                      )
                      if self.subscription_manager:
                          self.subscription_manager.notify(data.to_dict())
          finally:
              self._stopped.set()
docs: Thread main loop