Liking cljdoc? Tell your friends :D

telsos.lib.call


async-callclj/s

(async-call this f & args)

Asynchronously calls (apply f args). Returns a core.async channel that will receive:

  • the result (any value) on success
  • Throwable/js.Error on failure (validation, dispatch, transport, or timeout)
Asynchronously calls (apply f args).
Returns a core.async channel that will receive:
- the result (any value) on success
- Throwable/js.Error on failure (validation, dispatch, transport, or timeout)
raw docstring

AsyncCallerclj/sprotocol

-async-callclj/s

(-async-call this f args)

Internal. Use async-call instead.

Internal. Use async-call instead.

create-async-callerclj/s

(create-async-caller dispatch-fn
                     {:keys [timeout-ms max-retries args-validator
                             result-validator]
                      :or {max-retries 0}})

Creates an AsyncCaller backed by dispatch-fn.

dispatch-fn: (fn [f & args]) -> core.async channel with result or error

opts: :timeout-ms ms to wait for dispatch result (required) :max-retries max retry attempts on transport error or timeout (default 0) :args-validator (fn [args]) called before dispatch; throws to abort (optional) :result-validator (fn [result]) called on success; throws to abort (optional)

Retries on transport errors and timeouts only. Validator failures are not retried. Note: on timeout, the dispatch channel is abandoned (not closed). The dispatch go-block may still complete — its result will be GC'd.

Creates an AsyncCaller backed by dispatch-fn.

dispatch-fn: (fn [f & args]) -> core.async channel with result or error

opts:
  :timeout-ms       ms to wait for dispatch result (required)
  :max-retries      max retry attempts on transport error or timeout (default 0)
  :args-validator   (fn [args]) called before dispatch; throws to abort (optional)
  :result-validator (fn [result]) called on success; throws to abort (optional)

Retries on transport errors and timeouts only. Validator failures are not retried.
Note: on timeout, the dispatch channel is abandoned (not closed). The
dispatch go-block may still complete — its result will be GC'd.
raw docstring

error?clj/s

(error? x)

failing-alwaysclj/s

(failing-always handler)

Wraps handler so that every call returns an injected error value instead of delegating to handler. Use to stress-test behavior under persistent failure.

Wraps handler so that every call returns an injected error value instead of
delegating to handler. Use to stress-test behavior under persistent failure.
raw docstring

failing-randomlyclj/s

(failing-randomly n handler)

Wraps handler so that exactly one call per n-call window returns an injected error value instead of delegating to handler. The window always runs for exactly n calls; the single failing call within it is chosen at random. After n calls, a new fail position is chosen for the next window.

The returned fn returns an ex-info instance (not throws) on the failing call, matching the error-as-value convention expected by dispatch-fns used with create-async-caller.

Not thread-safe; intended for single-threaded test harnesses.

Wraps handler so that exactly one call per n-call window returns an injected
error value instead of delegating to handler. The window always runs for
exactly n calls; the single failing call within it is chosen at random. After
n calls, a new fail position is chosen for the next window.

The returned fn returns an ex-info instance (not throws) on the failing call,
matching the error-as-value convention expected by dispatch-fns used with
create-async-caller.

Not thread-safe; intended for single-threaded test harnesses.
raw docstring

handlercljmacro

(handler [request] & body)

std-json-handlerclj/s

(std-json-handler status decoder logic encoder)

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