Example #1
0
  private void saveCountings(int batchSize) {
    log.debug("Scheduled to save counting information, size=" + batchSize);

    List<Long> ids = new ArrayList<>();

    batchSize = (int) Math.min(batchSize, changeList.size(CACHE_CHANGE_LIST));
    for (int i = 0; i < batchSize; ++i) {
      ids.add(changeList.pop(CACHE_CHANGE_LIST));
    }

    for (Long id : ids) {
      postService.updatePostCounting(
          id, getVoteUp(id), getVoteDown(id), getPostHits(id), getReplies(id));
    }
  }