def do_clean_board(cursor=None): thq = Board.all() if cursor: thq.with_cursor(cursor) board = thq.get() if not board: logging.info("stop board clean") return threads = Thread.load_list(board.thread, board.key().name()) board.thread = [th for (th,data) in threads if data] fill_board(board) board.put() Cache.remove("board", board.key().name()) deferred.defer(do_clean_board, thq.cursor())
def do_clean_cache(cursor=None): cacheq = Cache.all(keys_only=True) if cursor: cacheq.with_cursor(cursor) cache = cacheq.get() if not cache: return if cache.parent().kind() == 'Board': db.delete(cache) deferred.defer(do_clean_cache, cacheq.cursor(), _countdown=2)
def do_clean_cache(cursor=None): cacheq = Cache.all() if cursor: cacheq.with_cursor(cursor) cache = cacheq.get() if not cache: logging.info("stop cache clean") return if cache.parent_key().kind() == 'Board': db.delete(cache) #elif cache.parent_key().kind() == 'Thread': # restore.from_cache(cache) deferred.defer(do_clean_cache, cacheq.cursor())