Skip to content

Commit

Permalink
use fixed 2 threads pool in http tests
Browse files Browse the repository at this point in the history
  • Loading branch information
neko-kai committed Nov 6, 2023
1 parent 7e3d2cc commit 8344540
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,25 @@ import logstage.LogIO
import org.http4s.dsl.Http4sDsl
import zio.IO

import java.util.concurrent.{Executor, Executors}
import scala.concurrent.ExecutionContext.global

object RT {
final val izLogger = makeLogger()
final val logger = LogIO.fromLogger[IO[Nothing, _]](makeLogger())
final val printer: Printer = Printer.noSpaces.copy(dropNullValues = true)

final val handler = UnsafeRun2.FailureHandler.Custom(message => izLogger.warn(s"Fiber failed: $message"))
implicit val IO2R: UnsafeRun2[zio.IO] = UnsafeRun2.createZIO(handler = handler)
final val dsl = Http4sDsl.apply[zio.IO[Throwable, _]]
final val execCtx = HttpExecutionContext(global)
final val handler = UnsafeRun2.FailureHandler.Custom(message => izLogger.warn(s"Fiber failed: $message"))
implicit val IO2R: UnsafeRun2[zio.IO] = UnsafeRun2.createZIO(
handler = handler,
customCpuPool = Some(
zio.Executor.fromJavaExecutor(
Executors.newFixedThreadPool(2)
)
),
)
final val dsl = Http4sDsl.apply[zio.IO[Throwable, _]]
final val execCtx = HttpExecutionContext(global)

private def makeLogger(): IzLogger = {
val router = ConfigurableLogRouter(
Expand Down

0 comments on commit 8344540

Please sign in to comment.