def poll(self):

        pubsub = self.conn.pubsub()
        pubsub.subscribe(self.key)

        # Pubsub messages generator
        gen = pubsub.listen()

        last_heartbeat = time.time()
        self.heartbeat()

        last_cleanup = time.time()
        self.cleanup()

        while True:
            # Since Redis' listen method blocks, we use select to inspect the
            # underlying socket to see if there is activity.
            fileno = pubsub.connection._sock.fileno()
            timeout = max(0, POLL_INTERVAL - (time.time() - last_heartbeat))
            r, w, x = self._select([fileno], [], [], timeout)
            if fileno in r:
                message = gen.next()
                self.update()

            last_heartbeat = time.time()
            self.heartbeat()

            now = time.time()
            if now - last_cleanup > CLEANUP_INTERVAL:
                last_cleanup = now
                self.cleanup()
Main loop which maintains the node in the hash ring. Can be run in a
dataset/ETHPy150Open closeio/redis-hashring/redis_hashring/__init__.py/RingNode.poll