(self, src_db, dst_db)
Table sync loop.

        Calls appropriate handles, which is expected to
        return one of SYNC_* constants.
Table sync loop.
Table sync loop .
def sync_tables(self, src_db, dst_db):
        """Table sync loop.

        Calls appropriate handles, which is expected to
        return one of SYNC_* constants."""

        self.log.debug('Sync tables')
        while 1:
            cnt = Counter(self.table_list)
            if self.copy_thread:
                res = self.sync_from_copy_thread(cnt, src_db, dst_db)
            else:
                res = self.sync_from_main_thread(cnt, src_db, dst_db)

            if res == SYNC_EXIT:
                self.log.debug('Sync tables: exit')
                if self.copy_thread:
                    self.unregister_consumer()
                src_db.commit()
                sys.exit(0)
            elif res == SYNC_OK:
                return
            elif res != SYNC_LOOP:
                raise Exception('Program error')

            self.log.debug('Sync tables: sleeping')
            time.sleep(3)
            dst_db.commit()
            self.load_table_state(dst_db.cursor())
            dst_db.commit()
def sync_tables ( self , src_db , dst_db ) : self . log . debug ( 'Sync tables' ) while 1 : cnt = Counter ( self . table_list ) if self . copy_thread : res = self . sync_from_copy_thread ( cnt , src_db , dst_db ) else : res = self . sync_from_main_thread ( cnt , src_db , dst_db ) if res == SYNC_EXIT : self . log . debug ( 'Sync tables: exit' ) if self . copy_thread : self . unregister_consumer ( ) src_db . commit ( ) sys . exit ( 0 ) elif res == SYNC_OK : return elif res != SYNC_LOOP : raise Exception ( 'Program error' ) self . log . debug ( 'Sync tables: sleeping' ) time . sleep ( 3 ) dst_db . commit ( ) self . load_table_state ( dst_db . cursor ( ) ) dst_db . commit ( )