Reconnect-loop ownership — Boundary stage of the resilience CPPB pipeline.
Single responsibility: drive the singleton milvus client back to a
reachable state after a transient failure. The loop's success
criterion is an actual probe round-trip, NOT the post-connect!
atom state — that distinction is the bug fix vs the prior design
where connect! always 'succeeded' (it just sets the atom) and the
loop exited even when the network was still down.
Decoupled from probe.clj (which owns the cache) and retry.clj
(which owns the reactive pipeline) per SRP. This ns owns ONE atom
(reconnect-state) and its loop future.
Time discipline: never call System/currentTimeMillis directly — go
through hive-ttracking.clock/now-millis so tests can pin time.
Reconnect-loop ownership — Boundary stage of the resilience CPPB pipeline. Single responsibility: drive the singleton milvus client back to a reachable state after a transient failure. The loop's success criterion is an actual probe round-trip, NOT the post-`connect!` atom state — that distinction is the bug fix vs the prior design where `connect!` always 'succeeded' (it just sets the atom) and the loop exited even when the network was still down. Decoupled from probe.clj (which owns the cache) and retry.clj (which owns the reactive pipeline) per SRP. This ns owns ONE atom (`reconnect-state`) and its loop future. Time discipline: never call `System/currentTimeMillis` directly — go through `hive-ttracking.clock/now-millis` so tests can pin time.
(await! max-wait-ms)Block up to max-wait-ms for the loop to verify recovery. Returns
true if the probe says alive at the end, false otherwise.
Uses probe/alive? (cached) so a burst of awaiters doesn't pound the
server. The loop itself uses probe/probe-once! (uncached) inside
try-reconnect-and-verify! to make sure each attempt actually
round-trips.
Block up to `max-wait-ms` for the loop to verify recovery. Returns true if the probe says alive at the end, false otherwise. Uses `probe/alive?` (cached) so a burst of awaiters doesn't pound the server. The loop itself uses `probe/probe-once!` (uncached) inside `try-reconnect-and-verify!` to make sure each attempt actually round-trips.
(kick! config-atom)Drop the dead client and start the heal loop if it isn't already running. Idempotent. Called by:
ensure-live! path (when the cache snapshot
reports dead but the loop is dormant)Drop the dead client and start the heal loop if it isn't already
running. Idempotent. Called by:
- the reactive retry path (after observing a failure)
- the proactive `ensure-live!` path (when the cache snapshot
reports dead but the loop is dormant)
- tests + ops tooling.(start-loop! config-atom
&
{:keys [base-ms max-ms] :or {base-ms 1000 max-ms 60000}})Background heal loop. Retries forever with exponential backoff +
jitter, capped at max-ms. Exits only when:
try-reconnect-and-verify! returns true (real round-trip ok), OR:running? false (e.g. on shutdown).No attempt ceiling — intermittent outages should self-heal whenever the network comes back.
Background heal loop. Retries forever with exponential backoff + jitter, capped at `max-ms`. Exits only when: - `try-reconnect-and-verify!` returns true (real round-trip ok), OR - another caller flips `:running?` false (e.g. on shutdown). No attempt ceiling — intermittent outages should self-heal whenever the network comes back.
(stop!)Stop the loop (if running) without disconnecting the client. Used by
the store's disconnect! path so the loop doesn't keep racing to
reconnect after the operator deliberately closed the store.
Stop the loop (if running) without disconnecting the client. Used by the store's `disconnect!` path so the loop doesn't keep racing to reconnect after the operator deliberately closed the store.
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 |