(self, dst_db, full_logic = True)
return state
Fetch consumer state from target node.

        This also sleeps if pause is set and updates
        "uptodate" flag to notify that data is refreshed.
Fetch consumer state from target node.
Fetch consumer state from target node .
def refresh_state(self, dst_db, full_logic = True):
        """Fetch consumer state from target node.

        This also sleeps if pause is set and updates
        "uptodate" flag to notify that data is refreshed.
        """

        while 1:
            q = "select * from pgq_node.get_consumer_state(%s, %s)"
            rows = self.exec_cmd(dst_db, q, [ self.queue_name, self.consumer_name ])
            state = rows[0]

            # tag refreshed
            if not state['uptodate'] and full_logic:
                q = "select * from pgq_node.set_consumer_uptodate(%s, %s, true)"
                self.exec_cmd(dst_db, q, [ self.queue_name, self.consumer_name ])

            if state['cur_error'] and self.work_state != -1:
                q = "select * from pgq_node.set_consumer_error(%s, %s, NULL)"
                self.exec_cmd(dst_db, q, [ self.queue_name, self.consumer_name ])

            if not state['paused'] or not full_logic:
                break
            time.sleep(self.loop_delay)

        # update connection
        loc = state['provider_location']
        if self.provider_connstr != loc:
            self.close_database(PDB)
            self.provider_connstr = loc
            # re-initialize provider connection
            db = self.get_provider_db(state);

        return state
def refresh_state ( self , dst_db , full_logic = True ) : while 1 : q = "select * from pgq_node.get_consumer_state(%s, %s)" rows = self . exec_cmd ( dst_db , q , [ self . queue_name , self . consumer_name ] ) state = rows [ 0 ] # tag refreshed if not state [ 'uptodate' ] and full_logic : q = "select * from pgq_node.set_consumer_uptodate(%s, %s, true)" self . exec_cmd ( dst_db , q , [ self . queue_name , self . consumer_name ] ) if state [ 'cur_error' ] and self . work_state != - 1 : q = "select * from pgq_node.set_consumer_error(%s, %s, NULL)" self . exec_cmd ( dst_db , q , [ self . queue_name , self . consumer_name ] ) if not state [ 'paused' ] or not full_logic : break time . sleep ( self . loop_delay ) # update connection loc = state [ 'provider_location' ] if self . provider_connstr != loc : self . close_database ( PDB ) self . provider_connstr = loc # re-initialize provider connection db = self . get_provider_db ( state ) return state