Fetches the next group of posts to process
966694
public function nextBatchAction() {
        $page = isset($_POST['page']) ? (int)$_POST['page'] : 1;

        $postData = $this->getImportBatch($page);

        json_response($postData);
    }
110347
function fetchPosts({state, actions, opts: {api}}, reddit) {
	let posts = state.postsByReddit[reddit]

	if (_shouldFetchPosts(posts)) {
		api.fetchPosts(reddit)
			.then(json => actions.postsFetched(reddit, json))

		return {
			...state,
			postsByReddit: {
				...state.postsByReddit,
				[reddit]: Object.assign({}, posts, {
					isFetching: true, 
					didInvalidate: false, 
					posts: []
				})
			}
		}

	}

	return state
}
375036
public function next()
    {
        $this->_row = $this->fetch();

        if ( !empty( $this->_row ) )
        {
            $this->_index++;
        }
    }
263504
def fetch(self, failures=True, wait=0):
        
        if self.started:
            return fetch_group(self.group, failures=failures, wait=wait, count=self.length(), cached=self.cached)
462689
def get_next_page(self, page_num, page_size):
        
        url = self._response_json.get(self.next_page_attr, None)
        if url is None:
            raise StopIteration()
        params, url = self.process_url(page_num, page_size, url)
        response = self.response_handler.api._get(url, raw_response=True, params=params)
        return response.json()
1089448
def post_order(self):
        """"""
        for child in self.children:
            for node in child.post_order():
                yield node
        yield self
118010
private synchronized boolean loadNextResults() {
        if ( atEndOfResults() )
            return false;

        do {
            nextResults.addAll(fetchNextPage());
        } while ( !atEndOfResults() && nextResults.isEmpty() );

        return !nextResults.isEmpty();
    }
613113
function find( $pattern, $limit, $offset, $orderby ) {
		global $wpdb;
		$results = [];

		$sql = "SELECT ID, post_content, post_title FROM {$wpdb->posts}
				WHERE post_type IN ('part','chapter','front-matter','back-matter')
				AND post_status NOT IN ('trash','inherit')
				ORDER BY ID ";
		$sql .= ( 'asc' === $orderby ) ? 'ASC' : 'DESC';
		if ( $limit > 0 ) {
			$sql .= sprintf( ' LIMIT %d,%d ', $offset, $limit );
		}

		$posts = $wpdb->get_results( $sql ); // @codingStandardsIgnoreLine

		if ( count( $posts ) > 0 ) {
			foreach ( $posts as $key => $post ) {
				$matches = $this->matches( $pattern, $post->post_content, $post->ID );
				if ( $matches ) {
					foreach ( $matches as $match ) {
						$match->title = $post->post_title;
					}
					$results = array_merge( $results, $matches );
				}
				unset( $posts[ $key ] ); // Reduce memory usage
			}
		}
		return $results;
	}
410276
def next(self):
        
        if self._has_finished:
            raise StopIteration

        if not len(self._buffer):
                    
            results = self.fetch_next_block()
            self._buffer.extend(results)
            
        if not len(self._buffer):
            raise StopIteration
            
        return self._buffer.popleft()
384634
public function postSearch(): void {
    if ($this->progress) {
      $iterator = $this->getIterator();

      if ($iterator instanceof \SplFileObject) {
        // Get current byte offset, after the line was read.
        $this->progress->setProgress($iterator->ftell());
      }
      elseif (is_int($key = $iterator->key())) {
        // Add one to the current index, because we're in the post-search phase.
        $this->progress->setProgress($key + 1);
      }
      else {
        // If iterator's key is not integer, just advance the progress with 1.
        $this->progress->advance();
      }
    }
  }
361978
def next(self):
        
        step = self.raw.get('max_results', 1000)
        start = self.raw.get('start_index', 1) + step
        self.raw['start_index'] = start
        return self
268039
def next(self):
        """"""
        if self._current_index < len(self._collection):
            value = self._collection[self._current_index]
            self._current_index += 1
            return value
        elif self._next_cursor:
            self.__fetch_next()
            return self.next()
        else:
            self._current_index = 0
            raise StopIteration
162124
protected function fetchNextRecords()
    {
        if (!$this->use_fixed_offset) {
            $this->query->offset($this->query_offset);
        }
        if ($this->clean_memory_on_fetch) {
            // Attempt to clean php memory
            $this->results_cache = null;
            BeanFactoryCache::clearCache();
            gc_collect_cycles();
        }
        $this->results_cache = $this->query->execute();
        $this->cache_current_index = 0;
    }
546771
def next(self, fetch: bool = False, next_symbol: _NextSymbol = DEFAULT_NEXT_SYMBOL) -> _Next:
        

        def get_next():
            candidates = self.find('a', containing=next_symbol)

            for candidate in candidates:
                if candidate.attrs.get('href'):
                    # Support 'next' rel (e.g. reddit).
                    if 'next' in candidate.attrs.get('rel', []):
                        return candidate.attrs['href']

                    # Support 'next' in classnames.
                    for _class in candidate.attrs.get('class', []):
                        if 'next' in _class:
                            return candidate.attrs['href']

                    if 'page' in candidate.attrs['href']:
                        return candidate.attrs['href']

            try:
                # Resort to the last candidate.
                return candidates[-1].attrs['href']
            except IndexError:
                return None

        __next = get_next()
        if __next:
            url = self._make_absolute(__next)
        else:
            return None

        if fetch:
            return self.session.get(url)
        else:
            return url
836271
def next(self):
        """"""
        d = None
        if self._first_results:
            d = succeed(EsUtils.extract_hits(self._first_results))
            self._first_results = None
        elif self._scroll_id:
            d = self._scroll_next_results()
        else:
            raise StopIteration()
        return d
934739
def retrieve_posts(dir)
      site.posts.docs.concat(PostReader.new(site).read_posts(dir))
      site.posts.docs.concat(PostReader.new(site).read_drafts(dir)) if site.show_drafts
    end
904784
def fetch_comments_async(prs)
      threads = []

      prs.each_slice(MAX_THREAD_NUMBER) do |prs_slice|
        prs_slice.each do |pr|
          threads << Thread.new do
            pr["comments"] = []
            iterate_pages(@client, "issue_comments", pr["number"]) do |new_comment|
              pr["comments"].concat(new_comment)
            end
            pr["comments"] = pr["comments"].map { |comment| stringify_keys_deep(comment.to_hash) }
          end
        end
        threads.each(&:join)
        threads = []
      end
      nil
    end