Role of `ZIO.executor` in the http4s + ZIO Adopt Tapir template

Hello :wave:

I’m not sure if it’s a “bug” in the template or am I misunderstanding something. Given this code:

    ZIO.executor.flatMap { _ =>
      EmberServerBuilder
        .default[Task]
        .withHost(Host.fromString("localhost").get)
        .withPort(port)
        .withHttpApp(Router("/" -> routes).orNotFound)
        .build
        .use { server =>
          for {
            _ <- Console.printLine(s"Server started at http://localhost:${server.address.getPort}. Press ENTER key to exit.")
            _ <- Console.readLine
          } yield ()
        }
    }

Do we really need the ZIO.executor? I know we needed it for the Blaze server (for .withExecutionContext), but Ember doesn’t seem to use it. Is the fact that the executor is “in scope” doing somerthing?

Thanks!

Yeah maybe that’s a leftover from the Blaze → Ember migration and we don’t need that … we’ll check :slight_smile:

1 Like