Skip to content

Commit

Permalink
Don't rethrow in AsyncPipe generator
Browse files Browse the repository at this point in the history
Summary: No need to rethrow here in cases where the dequeued try contains an exception.

Reviewed By: iahs

Differential Revision: D49323035

fbshipit-source-id: c96008f837168ac27632b5022daf2e7ca135ca60
  • Loading branch information
Adam Norton authored and facebook-github-bot committed Sep 18, 2023
1 parent 61c11d7 commit 6c2234c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions folly/experimental/coro/AsyncPipe.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,7 @@ class AsyncPipe {
[queue,
guard = std::move(guard)]() -> folly::coro::AsyncGenerator<T&&> {
while (true) {
auto val = co_await co_nothrow(queue->dequeue());
if (val.hasValue() || val.hasException()) {
co_yield std::move(*val);
} else {
co_return;
}
co_yield co_result(co_await co_nothrow(queue->dequeue()));
}
}),
AsyncPipe(queue, std::move(onClosedCallback))};
Expand Down

0 comments on commit 6c2234c

Please sign in to comment.