diff --git a/doobie-hikari/src/main/scala/com/avast/sst/doobie/DoobieHikariModule.scala b/doobie-hikari/src/main/scala/com/avast/sst/doobie/DoobieHikariModule.scala index 20707beec..72f49e14d 100644 --- a/doobie-hikari/src/main/scala/com/avast/sst/doobie/DoobieHikariModule.scala +++ b/doobie-hikari/src/main/scala/com/avast/sst/doobie/DoobieHikariModule.scala @@ -25,7 +25,7 @@ object DoobieHikariModule { metricsTrackerFactory: Option[MetricsTrackerFactory] = None )(implicit cs: ContextShift[F]): Resource[F, HikariTransactor[F]] = { for { - hikariConfig <- Resource.liftF(makeHikariConfig(config, metricsTrackerFactory)) + hikariConfig <- Resource.eval(makeHikariConfig(config, metricsTrackerFactory)) transactor <- HikariTransactor.fromHikariConfig(hikariConfig, boundedConnectExecutionContext, blocker) } yield transactor } diff --git a/example/src/main/scala/com/avast/sst/example/Main.scala b/example/src/main/scala/com/avast/sst/example/Main.scala index 11a2c556d..cc3ba1e62 100644 --- a/example/src/main/scala/com/avast/sst/example/Main.scala +++ b/example/src/main/scala/com/avast/sst/example/Main.scala @@ -32,17 +32,17 @@ object Main extends ZioServerApp { def program: Resource[Task, Server[Task]] = { for { - configuration <- Resource.liftF(PureConfigModule.makeOrRaise[Task, Configuration]) + configuration <- Resource.eval(PureConfigModule.makeOrRaise[Task, Configuration]) executorModule <- ExecutorModule.makeFromExecutionContext[Task](runtime.platform.executor.asEC) clock = Clock.create[Task] - currentTime <- Resource.liftF(clock.realTime(TimeUnit.MILLISECONDS)) + currentTime <- Resource.eval(clock.realTime(TimeUnit.MILLISECONDS)) console <- Resource.pure[Task, Console[Task]](ConsoleModule.make[Task]) - _ <- Resource.liftF( + _ <- Resource.eval( console.printLine(s"The current Unix epoch time is $currentTime. This system has ${executorModule.numOfCpus} CPUs.") ) meterRegistry <- MicrometerJmxModule.make[Task](configuration.jmx) - _ <- Resource.liftF(MicrometerJvmModule.make[Task](meterRegistry)) - serverMetricsModule <- Resource.liftF(MicrometerHttp4sServerMetricsModule.make[Task](meterRegistry, clock)) + _ <- Resource.eval(MicrometerJvmModule.make[Task](meterRegistry)) + serverMetricsModule <- Resource.eval(MicrometerHttp4sServerMetricsModule.make[Task](meterRegistry, clock)) boundedConnectExecutionContext <- executorModule .makeThreadPoolExecutor( @@ -56,8 +56,8 @@ object Main extends ZioServerApp { .make[Task](configuration.database, boundedConnectExecutionContext, executorModule.blocker, Some(hikariMetricsFactory)) randomService = RandomService(doobieTransactor) httpClient <- Http4sBlazeClientModule.make[Task](configuration.client, executorModule.executionContext) - circuitBreakerMetrics <- Resource.liftF(MicrometerCircuitBreakerMetricsModule.make[Task]("test-http-client", meterRegistry)) - circuitBreaker <- Resource.liftF(CircuitBreakerModule[Task].make(configuration.circuitBreaker, clock)) + circuitBreakerMetrics <- Resource.eval(MicrometerCircuitBreakerMetricsModule.make[Task]("test-http-client", meterRegistry)) + circuitBreaker <- Resource.eval(CircuitBreakerModule[Task].make(configuration.circuitBreaker, clock)) enrichedCircuitBreaker = withLogging("test-http-client", withMetrics(circuitBreakerMetrics, circuitBreaker)) client = Http4sClientCircuitBreakerModule.make[Task](httpClient, enrichedCircuitBreaker) routingModule = new Http4sRoutingModule(randomService, client, serverMetricsModule) diff --git a/fs2-kafka/src/test/scala/com/avast/sst/fs2kafka/Fs2KafkaModuleTest.scala b/fs2-kafka/src/test/scala/com/avast/sst/fs2kafka/Fs2KafkaModuleTest.scala index f41eecd7c..3936fb0f8 100644 --- a/fs2-kafka/src/test/scala/com/avast/sst/fs2kafka/Fs2KafkaModuleTest.scala +++ b/fs2-kafka/src/test/scala/com/avast/sst/fs2kafka/Fs2KafkaModuleTest.scala @@ -21,9 +21,9 @@ class Fs2KafkaModuleTest extends AsyncFunSuite with ForAllTestContainer { consumer <- Fs2KafkaModule.makeConsumer[IO, String, String]( ConsumerConfig(List(container.bootstrapServers), groupId = "test", autoOffsetReset = AutoOffsetReset.Earliest) ) - _ <- Resource.liftF(consumer.subscribeTo("test")) - _ <- Resource.liftF(producer.produce(ProducerRecords.one(ProducerRecord("test", "key", "value"))).flatten) - event <- Resource.liftF(consumer.stream.head.compile.toList) + _ <- Resource.eval(consumer.subscribeTo("test")) + _ <- Resource.eval(producer.produce(ProducerRecords.one(ProducerRecord("test", "key", "value"))).flatten) + event <- Resource.eval(consumer.stream.head.compile.toList) } yield assert(event.head.record.key === "key" && event.head.record.value === "value") io.use(IO.pure).unsafeToFuture() diff --git a/http4s-client-blaze/src/test/scala/com/avast/sst/http4s/client/Http4SBlazeClientTest.scala b/http4s-client-blaze/src/test/scala/com/avast/sst/http4s/client/Http4SBlazeClientTest.scala index 32dce0ed3..ab3e4e7be 100644 --- a/http4s-client-blaze/src/test/scala/com/avast/sst/http4s/client/Http4SBlazeClientTest.scala +++ b/http4s-client-blaze/src/test/scala/com/avast/sst/http4s/client/Http4SBlazeClientTest.scala @@ -23,7 +23,7 @@ class Http4SBlazeClientTest extends AsyncFunSuite { ), ExecutionContext.global ) - response <- Resource.liftF(client.expect[String]("https://httpbin.org/user-agent")) + response <- Resource.eval(client.expect[String]("https://httpbin.org/user-agent")) } yield assert(response === expected) test.use(IO.pure).unsafeToFuture() diff --git a/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala b/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala index ab252d4f1..13afe1447 100644 --- a/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala +++ b/http4s-server-blaze/src/main/scala/com/avast/sst/http4s/server/Http4sBlazeServerModule.scala @@ -21,7 +21,7 @@ object Http4sBlazeServerModule { executionContext: ExecutionContext ): Resource[F, Server[F]] = { for { - inetSocketAddress <- Resource.liftF( + inetSocketAddress <- Resource.eval( ConcurrentEffect[F].delay( InetSocketAddress.createUnresolved(config.listenAddress, config.listenPort) ) diff --git a/http4s-server/src/test/scala/com/avast/sst/http4s/server/middleware/CorrelationIdMiddlewareTest.scala b/http4s-server/src/test/scala/com/avast/sst/http4s/server/middleware/CorrelationIdMiddlewareTest.scala index 6ba1d786c..249b8510d 100644 --- a/http4s-server/src/test/scala/com/avast/sst/http4s/server/middleware/CorrelationIdMiddlewareTest.scala +++ b/http4s-server/src/test/scala/com/avast/sst/http4s/server/middleware/CorrelationIdMiddlewareTest.scala @@ -21,7 +21,7 @@ class CorrelationIdMiddlewareTest extends AsyncFunSuite with Http4sDsl[IO] { test("CorrelationIdMiddleware fills Request attributes and HTTP response header") { val test = for { - middleware <- Resource.liftF(CorrelationIdMiddleware.default[IO]) + middleware <- Resource.eval(CorrelationIdMiddleware.default[IO]) routes = Http4sRouting.make { middleware.wrap { HttpRoutes.of[IO] { case req @ GET -> Root / "test" => diff --git a/jvm/src/main/scala/com/avast/sst/jvm/execution/ExecutorModule.scala b/jvm/src/main/scala/com/avast/sst/jvm/execution/ExecutorModule.scala index 91d6efff4..65129c90d 100644 --- a/jvm/src/main/scala/com/avast/sst/jvm/execution/ExecutorModule.scala +++ b/jvm/src/main/scala/com/avast/sst/jvm/execution/ExecutorModule.scala @@ -58,7 +58,7 @@ object ExecutorModule { */ def makeDefault[F[_]: Sync]: Resource[F, ExecutorModule[F]] = { for { - numOfCpus <- Resource.liftF(Sync[F].delay(Runtime.getRuntime.availableProcessors)) + numOfCpus <- Resource.eval(Sync[F].delay(Runtime.getRuntime.availableProcessors)) coreSize = numOfCpus * 2 executor <- makeThreadPoolExecutor(ThreadPoolExecutorConfig(coreSize, coreSize), toolkitThreadFactory, new LinkedBlockingQueue) .map(ExecutionContext.fromExecutorService) @@ -71,7 +71,7 @@ object ExecutorModule { */ def makeFromExecutionContext[F[_]: Sync](executor: ExecutionContext): Resource[F, ExecutorModule[F]] = { for { - numOfCpus <- Resource.liftF(Sync[F].delay(Runtime.getRuntime.availableProcessors)) + numOfCpus <- Resource.eval(Sync[F].delay(Runtime.getRuntime.availableProcessors)) blockingExecutor <- makeBlockingExecutor.map(ExecutionContext.fromExecutorService) } yield new ExecutorModule[F](numOfCpus, executor, blockingExecutor) } @@ -81,7 +81,7 @@ object ExecutorModule { */ def makeFromConfig[F[_]: Sync](executorConfig: ThreadPoolExecutorConfig): Resource[F, ExecutorModule[F]] = { for { - numOfCpus <- Resource.liftF(Sync[F].delay(Runtime.getRuntime.availableProcessors)) + numOfCpus <- Resource.eval(Sync[F].delay(Runtime.getRuntime.availableProcessors)) executor <- makeThreadPoolExecutor(executorConfig, toolkitThreadFactory, new LinkedBlockingQueue) .map(ExecutionContext.fromExecutorService) blockingExecutor <- makeBlockingExecutor.map(ExecutionContext.fromExecutorService) @@ -93,7 +93,7 @@ object ExecutorModule { */ def makeForkJoinFromConfig[F[_]: Sync](executorConfig: ForkJoinPoolConfig): Resource[F, ExecutorModule[F]] = { for { - numOfCpus <- Resource.liftF(Sync[F].delay(Runtime.getRuntime.availableProcessors)) + numOfCpus <- Resource.eval(Sync[F].delay(Runtime.getRuntime.availableProcessors)) executor <- makeForkJoinPool(executorConfig, numOfCpus, toolkitThreadFactory) .map(ExecutionContext.fromExecutorService) blockingExecutor <- makeBlockingExecutor.map(ExecutionContext.fromExecutorService) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 4fff5ad68..163efe536 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -2,7 +2,7 @@ import sbt._ object Dependencies { - val catsEffect = "org.typelevel" %% "cats-effect" % "2.3.3" + val catsEffect = "org.typelevel" %% "cats-effect" % "2.4.0" val datastaxJavaDriverCore = "com.datastax.oss" % "java-driver-core" % Versions.datastaxJavaDriverCore val doobie = "org.tpolecat" %% "doobie-core" % Versions.doobie val doobieHikari = "org.tpolecat" %% "doobie-hikari" % Versions.doobie diff --git a/sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala b/sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala index 0eee59b36..51477734b 100644 --- a/sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala +++ b/sentry/src/main/scala/com/avast/sst/sentry/SentryModule.scala @@ -31,7 +31,7 @@ object SentryModule { */ def makeWithReleaseFromPackage[F[_]: Sync, Main: ClassTag](config: SentryConfig): Resource[F, Unit] = { for { - customizedConfig <- Resource.liftF { + customizedConfig <- Resource.eval { Sync[F].delay { for { pkg <- Option(implicitly[ClassTag[Main]].runtimeClass.getPackage)