diff --git a/build.sbt b/build.sbt index 85166d74..1dd4af30 100644 --- a/build.sbt +++ b/build.sbt @@ -5,7 +5,7 @@ import sbt.Keys.resolvers val mainScala = "2.13.14" val scala3Version = "3.3.3" val allScala = Seq(mainScala, scala3Version) -val zioVersion = "2.1.6" +val zioVersion = "2.1.8" val zioConfigVersion = "4.0.2" lazy val commonJvmSettings = Seq( diff --git a/rezilience/shared/src/main/scala/nl/vroste/rezilience/Bulkhead.scala b/rezilience/shared/src/main/scala/nl/vroste/rezilience/Bulkhead.scala index 82b24b2b..973ad620 100644 --- a/rezilience/shared/src/main/scala/nl/vroste/rezilience/Bulkhead.scala +++ b/rezilience/shared/src/main/scala/nl/vroste/rezilience/Bulkhead.scala @@ -83,7 +83,7 @@ object Bulkhead { onEnd = inFlightAndQueued.update(_.endProcess) _ <- ZStream .fromQueueWithShutdown(queue) - .mapZIOPar(maxInFlightCalls) { task => + .mapZIOPar(maxInFlightCalls, maxInFlightCalls) { task => ZIO.acquireReleaseWith(onStart)(_ => onEnd)(_ => task) } .runDrain diff --git a/rezilience/shared/src/test/scala/nl/vroste/rezilience/BulkheadSpec.scala b/rezilience/shared/src/test/scala/nl/vroste/rezilience/BulkheadSpec.scala index 6377ad92..2be7f2c0 100644 --- a/rezilience/shared/src/test/scala/nl/vroste/rezilience/BulkheadSpec.scala +++ b/rezilience/shared/src/test/scala/nl/vroste/rezilience/BulkheadSpec.scala @@ -48,7 +48,7 @@ object BulkheadSpec extends ZIOSpecDefault { .foreachParDiscard(1 to max + 2)(_ => bulkhead(callsCompleted.updateAndGet(_ + 1) *> ZIO.sleep(2.seconds)) ) - .withParallelismUnbounded + .withParallelism(100) .fork _ <- TestClock.adjust(1.second) nrCallsCompleted <- callsCompleted.get