Resource Release Issue in Layered Effect System

For some reason, I thought that if I have a layer like this, the resource will be released when the program exits:

const make = Effect.gen(function*() {
  const resource = yield* Effect.acquireRelease(acquire, release);

  return { /* etc */ }
})

export class MyService extends Context.Tag("MyService")<MyService, Effect.Effect.Succeed<typeof make>>() {
  static readonly live = Layer.scoped(this, make)
}


However, the release is never called when the program exits.
Was this page helpful?