Snakepit.Pool.WorkerSupervisor (snakepit v0.1.2)

DynamicSupervisor for pool worker processes.

This supervisor manages the lifecycle of workers:

  • Starts workers on demand
  • Handles crashes with automatic restarts
  • Provides clean shutdown of workers

Summary

Functions

Returns a specification to start this module under a supervisor.

Lists all supervised workers.

Restarts a worker by ID.

Starts the worker supervisor.

Starts a new pool worker with the given ID.

Stops a worker gracefully.

Returns the count of active workers.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

list_workers()

Lists all supervised workers.

restart_worker(worker_id)

Restarts a worker by ID.

start_link(init_arg)

Starts the worker supervisor.

start_worker(worker_id)

Starts a new pool worker with the given ID.

Examples

iex> Snakepit.Pool.WorkerSupervisor.start_worker("worker_123")
{:ok, #PID<0.123.0>}

stop_worker(worker_id)

Stops a worker gracefully.

worker_count()

Returns the count of active workers.