From 1b09b7854a291607cfe43eddda63cc91b4ee06c7 Mon Sep 17 00:00:00 2001 From: Adam Fraser Date: Sat, 29 Jul 2023 09:27:19 +0100 Subject: [PATCH] Use Latest ZIO Snapshot (#2345) * use latest zio snapshot * update * cleanup --- project/Dependencies.scala | 2 +- .../test/scala/zio/http/WebSocketSpec.scala | 36 +------------------ 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 2d365562e4..a46f21b538 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -6,7 +6,7 @@ object Dependencies { val NettyVersion = "4.1.94.Final" val NettyIncubatorVersion = "0.0.20.Final" val ScalaCompactCollectionVersion = "2.11.0" - val ZioVersion = "2.0.13" + val ZioVersion = "2.0.15+81-32928b56-SNAPSHOT" val ZioCliVersion = "0.5.0" val ZioSchemaVersion = "0.4.13" val SttpVersion = "3.3.18" diff --git a/zio-http/src/test/scala/zio/http/WebSocketSpec.scala b/zio-http/src/test/scala/zio/http/WebSocketSpec.scala index 394dac92f9..73f7ef1c86 100644 --- a/zio-http/src/test/scala/zio/http/WebSocketSpec.scala +++ b/zio-http/src/test/scala/zio/http/WebSocketSpec.scala @@ -26,35 +26,6 @@ import zio.http.ChannelEvent.{Read, Unregistered, UserEvent, UserEventTriggered} import zio.http.internal.{DynamicServer, HttpRunnableSpec, severTestLayer} object WebSocketSpec extends HttpRunnableSpec { - implicit class scopeDisconnect(scope: zio.Scope) { - def disconnect(label: String): Scope = - new Scope { - def addFinalizerExit(finalizer: Exit[Any, Any] => UIO[Any])(implicit trace: zio.Trace): UIO[Unit] = - scope.addFinalizerExit { (exit: Exit[Any, Any]) => - val warn = - ZIO - .logWarning( - s"A finalizer for layer ${label} has taken more than 1 minute to complete. Skipping this finalizer and moving onto the next one.", - ) - .delay(1.minute) - .unit - - finalizer(exit).disconnect.race(warn) - } - - def forkWith(executionStrategy: => zio.ExecutionStrategy)(implicit trace: zio.Trace): UIO[Scope.Closeable] = - scope.forkWith(executionStrategy) - } - } - implicit class layerDisconnect[I, E, O](layer: ZLayer[I, E, O]) { - def disconnect(label: String): ZLayer[I, E, O] = - ZLayer.scopedEnvironment[I] { - for { - scope <- ZIO.scope - zenv <- layer.build(scope.disconnect(label)) - } yield zenv - } - } private val websocketSpec = suite("WebsocketSpec")( test("channel events between client and server") { @@ -241,12 +212,7 @@ object WebSocketSpec extends HttpRunnableSpec { serve.as(List(websocketSpec)) } } - .provideShared( - DynamicServer.live.disconnect("DynamicServer.live"), - severTestLayer.disconnect("serverTestLayer"), - Client.default.disconnect("Client.default"), - Scope.default, - ) @@ + .provideShared(DynamicServer.live, severTestLayer, Client.default, Scope.default) @@ timeout(30 seconds) @@ diagnose(30.seconds) @@ withLiveClock @@ sequential final class MessageCollector[A](ref: Ref[List[A]], promise: Promise[Nothing, Unit]) {