Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Netty's leak detection in QuickAdapter#runServer #2288

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion adapters/quick/src/main/scala/caliban/QuickAdapter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package caliban
import caliban.Configurator.ExecutionConfiguration
import zio._
import zio.http._
import zio.http.netty.NettyConfig
import zio.http.netty.NettyConfig.LeakDetectionLevel
import zio.stacktracer.TracingImplicits.disableAutoTrace

final class QuickAdapter[R] private (requestHandler: QuickRequestHandler[R]) {
Expand Down Expand Up @@ -80,7 +82,11 @@ final class QuickAdapter[R] private (requestHandler: QuickRequestHandler[R]) {
)(implicit trace: Trace, tag: Tag[R]): RIO[R, Nothing] =
Server
.serve[R](routes(apiPath, graphiqlPath = graphiqlPath, uploadPath = uploadPath, webSocketPath = webSocketPath))
.provideSomeLayer[R](Server.defaultWithPort(port))
.provideSomeLayer[R](
ZLayer.succeed(Server.Config.default.port(port))
++ ZLayer.succeed(NettyConfig.default.leakDetection(LeakDetectionLevel.DISABLED))
>+> Server.customized
)
Comment on lines +85 to +89
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: I wanted to use provideSome but I got slapped with a different variant of this issue, due to an ambiguity in the implicit trace


def configure(config: ExecutionConfiguration)(implicit trace: Trace): QuickAdapter[R] =
new QuickAdapter(requestHandler.configure(config))
Expand Down
Loading