PlaidEx.Reliability.Bulkhead (plaid_ex v1.0.0)

Copy Markdown View Source

Bulkhead isolation using bounded process pools.

Prevents a spike in one area (e.g., investment sync for one tenant) from exhausting resources needed by another (e.g., auth for all tenants).

Named bulkheads

  • :transactions — transaction sync workers
  • :webhooks — webhook processing
  • :investments — investment data ingestion
  • :transfers — transfer operations
  • :general — default for uncategorised requests

Usage

PlaidEx.Reliability.Bulkhead.run(:transactions, fn ->
  PlaidEx.API.Transactions.sync(config, access_token: token)
end)

Returns {:ok, result} or {:error, :bulkhead_full} if the pool is at capacity.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns child specs for all bulkhead pools, suitable for a Supervisor.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

child_specs()

@spec child_specs() :: [map()]

Returns child specs for all bulkhead pools, suitable for a Supervisor.

run(pool_name, fun, opts \\ [])

@spec run(atom(), (-> term()), keyword()) :: {:ok, term()} | {:error, :bulkhead_full}

start_link(arg)

@spec start_link({atom(), pos_integer()}) :: GenServer.on_start()

status(pool_name)

@spec status(atom()) :: map()