Skip to content

Commit

Permalink
Fix client connection leak on non-failure, non-interruption cases (sc…
Browse files Browse the repository at this point in the history
…alapb#648)

Fix client connection leak on non-failure, non-interruption cases
  • Loading branch information
ghostdogpr authored Jul 17, 2024
1 parent 03d623d commit aa3e67e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions core/src/main/scalajvm/scalapb/zio_grpc/client/ClientCalls.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,16 @@ object ClientCalls {

def exitHandler[Req, Res](
call: ZClientCall[Req, Res]
)(l: Any, ex: Exit[StatusException, Any]) = anyExitHandler(call)(l, ex)
)(l: Any, ex: Exit[StatusException, Any]) =
ZIO.when(!ex.isSuccess) {
anyExitHandler(call)(l, ex)
}

// less type safe
def anyExitHandler[Req, Res](
call: ZClientCall[Req, Res]
) =
(_: Any, ex: Exit[Any, Any]) =>
ZIO.when(!ex.isSuccess) {
call.cancel("Interrupted").ignore
}
(_: Any, ex: Exit[Any, Any]) => call.cancel("Interrupted").ignore

def unaryCall[Req, Res](
channel: ZChannel,
Expand Down

0 comments on commit aa3e67e

Please sign in to comment.