Example #1
0
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

  """
  board_c = BoardCounter(key_name=board.key().name())
  board_c.counter = board._entity.get('counter')
  board_c.put()
  """
  keys = board.linked
  if not keys:
    keys = [ (board.code, th) for th in board.thread]

  threads = Thread.load_list(keys)

  board.linked = [th for (th,data) in zip(keys, threads) if data]
  fill_board(board)

  board.put()
  #Cache.remove("board", board.key().name())

  deferred.defer(do_clean_board, thq.cursor())
Example #2
0
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]
  board.put()

  deferred.defer(do_clean_board, thq.cursor())