Liking cljdoc? Tell your friends :D

hive-weave.single-flight

Single-flight: concurrent callers of one key share one computation.

The first caller for a key registers a promise and runs the compute fn; every caller that arrives while it is in flight derefs that promise instead of computing. Once the computation settles the key is released, so the next caller computes again: this deduplicates in-flight work, it does not cache results.

Copied from hive-mcp.tools.catchup.bundle-cache/single-flight (the same shape as hive-cache.core/with-single-flight, without event emission) so that both can delegate here.

Single-flight: concurrent callers of one key share one computation.

The first caller for a key registers a promise and runs the compute fn;
every caller that arrives while it is in flight derefs that promise
instead of computing. Once the computation settles the key is released,
so the next caller computes again: this deduplicates in-flight work, it
does not cache results.

Copied from hive-mcp.tools.catchup.bundle-cache/single-flight (the same
shape as hive-cache.core/with-single-flight, without event emission) so
that both can delegate here.
raw docstring

in-flightclj

(in-flight)
(in-flight reg)

The keys currently being computed in reg (the shared registry when called without one).

The keys currently being computed in `reg` (the shared registry when
called without one).
sourceraw docstring

registryclj

(registry)

A fresh in-flight registry: key -> promise of the pending result.

A fresh in-flight registry: key -> promise of the pending result.
sourceraw docstring

runclj

(run reg key compute-fn)

Run compute-fn for key in reg unless a computation for key is already in flight, in which case wait for it and return its result. A failure is re-thrown to the computing caller as itself and surfaced to waiters as an ex-info {:key key} whose cause is the failure.

Run `compute-fn` for `key` in `reg` unless a computation for `key` is
already in flight, in which case wait for it and return its result.
A failure is re-thrown to the computing caller as itself and surfaced to
waiters as an ex-info {:key key} whose cause is the failure.
sourceraw docstring

single-flightclj

(single-flight key compute-fn)

run against the namespace's shared registry.

`run` against the namespace's shared registry.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close