def handle_pong(self, msg):
        "a heart just beat"
        current = asbytes(str(self.lifetime))
        last = asbytes(str(self.last_ping))
        if msg[1] == current:
            delta = time.time()-self.tic
            # self.log.debug("heartbeat::heart %r took %.2f ms to respond"%(msg[0], 1000*delta))
            self.responses.add(msg[0])
        elif msg[1] == last:
            delta = time.time()-self.tic + (self.last_ping-self.lifetime)
            self.log.warn("heartbeat::heart %r missed a beat, and took %.2f ms to respond"%(msg[0], 1000*delta))
            self.responses.add(msg[0])
        else:
            self.log.warn("heartbeat::got bad heartbeat (possibly old?): %s (current=%.3f)"%
            (msg[1],self.lifetime))
dataset/ETHPy150Open ipython/ipython-py3k/IPython/parallel/controller/heartmonitor.py/HeartMonitor.handle_pong/swapped operands of `-`