(self, dst_db, node_name)
Core logic for waiting.
Core logic for waiting.
Core logic for waiting .
def wait_for_node(self, dst_db, node_name):
        """Core logic for waiting."""

        self.log.info("Fetching last tick for %s", node_name)
        node_info = self.load_node_info(node_name)
        tick_id = node_info.last_tick

        self.log.info("Waiting for tick > %d", tick_id)

        q = "select * from pgq_node.get_node_info(%s)"
        dst_curs = dst_db.cursor()

        while 1:
            dst_curs.execute(q, [self.queue_name])
            row = dst_curs.fetchone()
            dst_db.commit()

            if row['ret_code'] >= 300:
                self.log.warning("Problem: %s", row['ret_code'], row['ret_note'])
                return

            if row['worker_last_tick'] > tick_id:
                self.log.info("Got tick %d, exiting", row['worker_last_tick'])
                break

            self.sleep(2)
def wait_for_node ( self , dst_db , node_name ) : self . log . info ( "Fetching last tick for %s" , node_name ) node_info = self . load_node_info ( node_name ) tick_id = node_info . last_tick self . log . info ( "Waiting for tick > %d" , tick_id ) q = "select * from pgq_node.get_node_info(%s)" dst_curs = dst_db . cursor ( ) while 1 : dst_curs . execute ( q , [ self . queue_name ] ) row = dst_curs . fetchone ( ) dst_db . commit ( ) if row [ 'ret_code' ] >= 300 : self . log . warning ( "Problem: %s" , row [ 'ret_code' ] , row [ 'ret_note' ] ) return if row [ 'worker_last_tick' ] > tick_id : self . log . info ( "Got tick %d, exiting" , row [ 'worker_last_tick' ] ) break self . sleep ( 2 )