Package: effect
Module: PubSub
Returns the current number of messages retained by the PubSub for active
subscribers synchronously.
When to use
Use when an immediate PubSub size snapshot is needed outside effectful code
and concurrent changes between the check and later use are acceptable.
Details
Returns 0 after shutdown. Because this is an unsafe synchronous snapshot,
prefer size in effectful code.
Example (Reading size synchronously)
import { PubSub } from "effect"
// Unsafe synchronous size check
declare const pubsub: PubSub.PubSub<string>
const size = PubSub.sizeUnsafe(pubsub)
console.log("Current size:", size)
Signature
declare const sizeUnsafe: <A>(self: PubSub<A>) => number
Since v4.0.0