Skip to content

Commit

Permalink
post review 5
Browse files Browse the repository at this point in the history
  • Loading branch information
dkalinowski committed Aug 6, 2024
1 parent 30eb788 commit f5efbd4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cpp/src/generation_handle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ GenerationStatus GenerationHandleImpl::get_status() {
}

bool GenerationHandleImpl::can_read() {
return m_generation_stream->can_read();
return !is_dropped() && m_generation_stream->can_read();
}

bool GenerationHandleImpl::is_dropped() {
Expand Down Expand Up @@ -55,7 +55,7 @@ std::vector<GenerationOutput> GenerationHandleImpl::read_all() {
std::vector<GenerationOutput> results;
std::unordered_map<uint64_t, GenerationOutput> partial_results;
// We iterate until generation is running or there are tokens we haven't read yet
while (!is_dropped() && (get_status() == GenerationStatus::RUNNING || can_read())) {
while (get_status() == GenerationStatus::RUNNING || can_read()) {
// For unary case there's only one iteration and we get all results in a single read() call
std::unordered_map<uint64_t, GenerationOutput> iteration_results = read();
add_partial_result(partial_results, iteration_results);
Expand Down

0 comments on commit f5efbd4

Please sign in to comment.