(request: Request, server: BunServer<WebSocketContext>)
| 136 | const shutdown = yield* Effect.promise(() => server.stop()).pipe( |
| 137 | Effect.cached |
| 138 | ) |
| 139 | const preemptiveShutdown = options.disablePreemptiveShutdown ? Effect.void : Effect.timeoutOrElse(shutdown, { |
| 140 | duration: options.gracefulShutdownTimeout ?? Duration.seconds(20), |
| 141 | orElse: () => Effect.void |
| 142 | }) |
| 143 | |
| 144 | yield* Scope.addFinalizer(scope, shutdown) |
| 145 | |
| 146 | return Server.make({ |
| 147 | address: { _tag: "TcpAddress", port: server.port!, hostname: server.hostname! }, |
| 148 | serve: Effect.fnUntraced(function*(httpApp, middleware) { |
| 149 | const parent = yield* Effect.fiber |
| 150 | const services = parent.context |
| 151 | const serveScope = Context.getUnsafe(services, Scope.Scope) |
| 152 | const scope = Scope.forkUnsafe(serveScope, "parallel") |
| 153 |
searching dependent graphs…