Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
fix interruption
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed Dec 17, 2023
1 parent e642170 commit a337704
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/platform-browser/src/internal/workerRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as Runtime from "@effect/platform/Runtime"
import { WorkerError } from "@effect/platform/WorkerError"
import * as Runner from "@effect/platform/WorkerRunner"
import type * as Schema from "@effect/schema/Schema"
import { Cause } from "effect"
import * as Cause from "effect/Cause"
import * as Effect from "effect/Effect"
import * as Layer from "effect/Layer"
import * as Queue from "effect/Queue"
Expand Down
23 changes: 10 additions & 13 deletions packages/platform-node/src/internal/http/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type * as Path from "@effect/platform/Path"
import * as Cause from "effect/Cause"
import * as Config from "effect/Config"
import * as Effect from "effect/Effect"
import type { LazyArg } from "effect/Function"
import { type LazyArg } from "effect/Function"
import * as Layer from "effect/Layer"
import * as Option from "effect/Option"
import * as Runtime from "effect/Runtime"
Expand Down Expand Up @@ -71,18 +71,15 @@ export const make = (
port: address.port
},
serve: (httpApp, middleware) =>
Effect.asUnit(
Effect.acquireRelease(
Effect.tap(makeHandler(httpApp, middleware!), (handler) =>
Effect.sync(() => {
server.on("request", handler)
})),
(handler) =>
Effect.sync(() => {
server.off("request", handler)
})
)
)
Effect.gen(function*(_) {
const handler = yield* _(makeHandler(httpApp, middleware!))
yield* _(Effect.addFinalizer(() =>
Effect.sync(() => {
server.off("request", handler)
})
))
server.on("request", handler)
})
})
}).pipe(
Effect.locally(
Expand Down
2 changes: 1 addition & 1 deletion packages/platform-node/src/internal/stream.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { SizeInput } from "@effect/platform/FileSystem"
import type { Cause } from "effect"
import type * as Cause from "effect/Cause"
import * as Channel from "effect/Channel"
import * as Chunk from "effect/Chunk"
import * as Effect from "effect/Effect"
Expand Down
2 changes: 1 addition & 1 deletion packages/platform/src/Http/Router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
*/
import type * as ParseResult from "@effect/schema/ParseResult"
import type * as Schema from "@effect/schema/Schema"
import type { Scope } from "effect"
import type * as Cause from "effect/Cause"
import type * as Chunk from "effect/Chunk"
import type * as Context from "effect/Context"
import type * as Effect from "effect/Effect"
import type * as Option from "effect/Option"
import type * as Scope from "effect/Scope"
import * as internal from "../internal/http/router.js"
import type * as App from "./App.js"
import type * as Method from "./Method.js"
Expand Down

0 comments on commit a337704

Please sign in to comment.