Skip to content

Commit

Permalink
close stream and log error instead of fatal
Browse files Browse the repository at this point in the history
Summary:
instead of crashing when receiving stream when starting it logs and error message and closes the stream

#build_more

Reviewed By: nomiero

Differential Revision: D66776869

fbshipit-source-id: 86a1ef92a03c7eb803e7a3c9c4dd42fa3a41ab63
  • Loading branch information
Robert Roeser authored and facebook-github-bot committed Dec 5, 2024
1 parent 765c85d commit 14524f0
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@ ServerStreamFn<T> ServerGeneratorStream::fromAsyncGenerator(
std::move(gen),
TileStreamGuard::transferFrom(std::move(interaction)))
.scheduleOn(std::move(serverExecutor))
.start([](folly::Try<folly::Unit> t) {
.start([sp = stream->copy()](folly::Try<folly::Unit> t) {
if (t.hasException()) {
LOG(FATAL) << t.exception();
LOG(ERROR)
<< "Closing Stream because it received an exception before it started: "
<< std::endl
<< t.exception();
sp->close();
}
});
std::ignore =
Expand Down

0 comments on commit 14524f0

Please sign in to comment.