Render queue — single coordination primitive for the per-tab renderer.
Replaces the previous atoms (pending-partials*, full-render-needed*, pending-scripts*) and Semaphore with a single LinkedBlockingQueue.
Writers (HTTP handler threads, reactive watch callbacks) enqueue typed
events; the renderer fiber drains them in batches via drain!, which
blocks until at least one event is available and then atomically drains
all pending events into a categorized map.
This eliminates all shared mutable state between producer and consumer threads — the queue IS the coordination primitive.
Render queue — single coordination primitive for the per-tab renderer. Replaces the previous atoms (pending-partials*, full-render-needed*, pending-scripts*) and Semaphore with a single LinkedBlockingQueue. Writers (HTTP handler threads, reactive watch callbacks) enqueue typed events; the renderer fiber drains them in batches via `drain!`, which blocks until at least one event is available and then atomically drains all pending events into a categorized map. This eliminates all shared mutable state between producer and consumer threads — the queue IS the coordination primitive.
(drain! q)(drain! q timeout-ms)Block until at least one event is available, then drain all pending events.
Returns a categorized map: {:shutdown? boolean — true if a :shutdown event was present :full-render? boolean — true if any :full-render event was present :dirty-ids #{...} — set of component IDs needing partial render :scripts [...]} — vector of JS strings in FIFO order
When timeout-ms is given, blocks at most that long for the first event;
if none arrives the result is flagged :idle? true (used to drive the
heartbeat keepalive). The blocking single-arity never returns :idle?.
This is the only function that removes events from the queue. Designed for single-consumer use (the renderer fiber).
Block until at least one event is available, then drain all pending events.
Returns a categorized map:
{:shutdown? boolean — true if a :shutdown event was present
:full-render? boolean — true if any :full-render event was present
:dirty-ids #{...} — set of component IDs needing partial render
:scripts [...]} — vector of JS strings in FIFO order
When `timeout-ms` is given, blocks at most that long for the first event;
if none arrives the result is flagged `:idle? true` (used to drive the
heartbeat keepalive). The blocking single-arity never returns `:idle?`.
This is the only function that removes events from the queue.
Designed for single-consumer use (the renderer fiber).(enqueue-full-render! q)Signal that a full page render is needed.
Signal that a full page render is needed.
(enqueue-partial! q component-id)Signal that a reactive component needs re-rendering.
Signal that a reactive component needs re-rendering.
(enqueue-scripts! q scripts)Queue one or more scripts for SSE delivery to the client.
Queue one or more scripts for SSE delivery to the client.
(enqueue-shutdown! q)Signal the renderer to shut down. Unblocks a pending drain! call.
Signal the renderer to shut down. Unblocks a pending `drain!` call.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |