HttpPool (fnord v0.8.83)

View Source

Provides a per-process HTTP pool override mechanism for Hackney pools.

By default, calls to HTTP clients will use the :ai_api pool. Processes such as background indexers can override this setting locally, ensuring their HTTP requests are routed through a dedicated :ai_indexer pool without affecting other processes.

Summary

Functions

Clears any HTTP pool override in the current process, reverting to default.

Returns the current process HTTP pool override, defaulting to :ai_api.

Overrides the HTTP pool for the current process.

Temporarily sets the HTTP pool override for the duration of the given function.

Functions

clear()

@spec clear() :: :ok

Clears any HTTP pool override in the current process, reverting to default.

get()

@spec get() :: atom()

Returns the current process HTTP pool override, defaulting to :ai_api.

set(pool)

@spec set(atom()) :: :ok

Overrides the HTTP pool for the current process.

Examples

HttpPool.set(:ai_indexer)

with_pool(pool, fun)

@spec with_pool(atom(), (-> any())) :: any()

Temporarily sets the HTTP pool override for the duration of the given function.

The pool override is restored to its previous value after the function returns or raises.