From 68ee2a4ea875ea7ff10c65cd753983c1fa81fb59 Mon Sep 17 00:00:00 2001 From: kyri-petrou <67301607+kyri-petrou@users.noreply.github.com> Date: Mon, 17 Jun 2024 14:37:41 +1000 Subject: [PATCH] Disable netty's LeakDetection by default (#2288) --- adapters/quick/src/main/scala/caliban/QuickAdapter.scala | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/adapters/quick/src/main/scala/caliban/QuickAdapter.scala b/adapters/quick/src/main/scala/caliban/QuickAdapter.scala index f78244b77..8aa39760e 100644 --- a/adapters/quick/src/main/scala/caliban/QuickAdapter.scala +++ b/adapters/quick/src/main/scala/caliban/QuickAdapter.scala @@ -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]) { @@ -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 + ) def configure(config: ExecutionConfiguration)(implicit trace: Trace): QuickAdapter[R] = new QuickAdapter(requestHandler.configure(config))