fix(ts): close effect native review blockers

This commit is contained in:
elpresidank 2026-06-06 11:01:17 -05:00
parent b6759e75df
commit a26463afc1
13 changed files with 438 additions and 528 deletions

View file

@ -384,3 +384,17 @@ export function makeNatsBackend(url = "nats://localhost:4222"): PubSubBackend {
}),
};
}
export const makeNatsBackendScoped = (url = "nats://localhost:4222") =>
Effect.acquireRelease(
Effect.sync(() => makeNatsBackend(url)),
(backend) =>
backend.close.pipe(
Effect.catch((error) =>
Effect.logError("[NatsBackend] Failed to close scoped backend", {
error: error.message,
operation: error.operation,
})
),
),
);