You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pekko.apache.org by en...@apache.org on 2024/10/31 09:31:31 UTC
(pekko-grpc) branch main updated: Apply trailer only optimization for responseForSingleElement (#396)
This is an automated email from the ASF dual-hosted git repository.
engelen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pekko-grpc.git
The following commit(s) were added to refs/heads/main by this push:
new e616c6a9 Apply trailer only optimization for responseForSingleElement (#396)
e616c6a9 is described below
commit e616c6a950359c670400f0b5d502610cc7e74151
Author: navid <na...@moia.io>
AuthorDate: Thu Oct 31 10:31:26 2024 +0100
Apply trailer only optimization for responseForSingleElement (#396)
* apply trailer only optimization for responseForSingleElement
* remove unused import
---
.../org/apache/pekko/grpc/internal/GrpcResponseHelpers.scala | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/runtime/src/main/scala/org/apache/pekko/grpc/internal/GrpcResponseHelpers.scala b/runtime/src/main/scala/org/apache/pekko/grpc/internal/GrpcResponseHelpers.scala
index 75cb3e2b..848fc629 100644
--- a/runtime/src/main/scala/org/apache/pekko/grpc/internal/GrpcResponseHelpers.scala
+++ b/runtime/src/main/scala/org/apache/pekko/grpc/internal/GrpcResponseHelpers.scala
@@ -24,7 +24,6 @@ import pekko.http.scaladsl.model.HttpEntity.ChunkStreamPart
import pekko.http.scaladsl.model.{ HttpEntity, HttpResponse, Trailer }
import pekko.stream.Materializer
import pekko.stream.scaladsl.Source
-import pekko.util.ByteString
import io.grpc.Status
import scala.collection.immutable
@@ -60,12 +59,7 @@ object GrpcResponseHelpers {
val responseHeaders = headers.`Message-Encoding`(writer.messageEncoding.name) :: Nil
try writer.encodeDataToResponse(m.serialize(e), responseHeaders, TrailerOkAttribute)
catch {
- case NonFatal(ex) =>
- val trailers = GrpcEntityHelpers.handleException(ex, eHandler)
- writer.encodeDataToResponse(
- ByteString.empty,
- responseHeaders,
- Trailer(GrpcEntityHelpers.trailer(trailers.status, trailers.metadata).trailers))
+ case NonFatal(ex) => status(GrpcEntityHelpers.handleException(ex, eHandler))
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pekko.apache.org
For additional commands, e-mail: commits-help@pekko.apache.org