Hyperlinkv0.8.0-beta.28

PubSub

PubSub.isShutdownUnsafeconsteffect/PubSub.ts:824
<A>(self: PubSub<A>): boolean

Checks synchronously whether shutdown has been called, returning true after shutdown and false otherwise.

When to use

Use when an immediate PubSub shutdown-state snapshot is needed outside effectful code and racing shutdown changes are acceptable.

Example (Checking shutdown synchronously)

import { PubSub } from "effect"

declare const pubsub: PubSub.PubSub<string>

// Unsafe synchronous shutdown check
const isDown = PubSub.isShutdownUnsafe(pubsub)
if (isDown) {
  console.log("PubSub is shutdown, cannot publish")
} else {
  console.log("PubSub is active")
}
predicates
Source effect/PubSub.ts:8241 lines
export const isShutdownUnsafe = <A>(self: PubSub<A>): boolean => self.shutdownFlag.current
Referenced by 1 symbols