Hyperlinkv0.8.0-beta.28

Polling

Polling.wakeOnconstsrc/Polling.ts:676

Wire a stream to a cadence control: every element runs wake (or any control effect), so an external fact — a queue add event, a store change — ends the polling wait IMMEDIATELY instead of waiting out the interval. Forked into the current scope.

Pair with adaptive: point it at proc.polling.resetCadence and arrivals snap the drainer back to its active cadence.

combinatorsadaptive
Source src/Polling.ts:6765 lines
export const wakeOn = <A, R>(
  stream: Stream.Stream<A, never, R>,
  wake: Effect.Effect<void>
): Effect.Effect<void, never, R | Scope.Scope> =>
  Effect.asVoid(Effect.forkScoped(Stream.runForEach(stream, () => wake)));