Effect CommunityEC
Effect Community3y ago
3 replies
mepuka

Understanding Fiber Count in Logs

How does fiber count work (for example if I'm looking at logs)? it seems like the fiber # always increments by one? it has nothing to do with the number of fibers currently running correct? For example in this http server example each request produces a fiber and increments the count by one? any background on this?

const ServerLive = Http.server.layer({ port: 3000 })

const serve = Http.router.empty.pipe(
  Http.router.get(
    "/",
    Effect.flatMap(
      Http.request.ServerRequest,
      (_) => Http.response.file('./views/index.html')
    )
  ),
  Http.server.serve(Http.middleware.logger)
)

const EnvLive = Layer.merge(ServerLive, BunContext.layer)

serve.pipe(
  Effect.scoped,
  Effect.provideLayer(EnvLive),
  Effect.tapErrorCause(Effect.logError),
  runMain
)
Screenshot_2023-09-09_at_9.35.49_PM.png
Was this page helpful?