PlaidEx.Sync.SyncSupervisor (plaid_ex v1.0.0)

Copy Markdown View Source

DynamicSupervisor managing transaction sync workers.

Each access token gets its own supervised TransactionSync worker. Workers are :transient — they restart on unexpected crashes but stop cleanly when asked.

Workers are deduplicated by access token. Attempting to start a second worker for the same access token returns {:error, :already_started}.

Summary

Functions

Returns a specification to start this module under a supervisor.

Returns a list of all running sync workers with their status.

Starts a sync worker. Returns {:error, :already_started} if one exists for this access token.

Number of active sync workers.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

list_workers()

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

Returns a list of all running sync workers with their status.

start_link(opts)

@spec start_link(keyword()) :: Supervisor.on_start()

start_worker(access_token, config, opts)

@spec start_worker(String.t(), PlaidEx.Config.t(), keyword()) ::
  {:ok, pid()} | {:error, :already_started | term()}

Starts a sync worker. Returns {:error, :already_started} if one exists for this access token.

worker_count()

@spec worker_count() :: non_neg_integer()

Number of active sync workers.