Package: effect
Module: TxQueue
Interrupts the queue gracefully with the current fiber’s interruption cause.
Details
If the queue still contains items, it enters the closing state so buffered items can be drained before consumers observe the interruption. If it is empty, it transitions directly to done. Returns false if the queue was already closing or done.
Example (Interrupting queues)
import { Effect, TxQueue } from "effect"
const program = Effect.gen(function*() {
const queue = yield* TxQueue.bounded<number>(10)
yield* TxQueue.offer(queue, 42)
// Interrupt gracefully - allows remaining items to be consumed
const result = yield* TxQueue.interrupt(queue)
console.log(result) // true
})
Signature
declare const interrupt: <A, E>(self: TxEnqueue<A, E>) => Effect.Effect<boolean>
Since v4.0.0