Snakepit.Pool.Worker.Starter (snakepit v0.1.2)
Supervisor wrapper for individual workers that provides automatic restart capability.
This module implements the "Permanent Wrapper" pattern that allows DynamicSupervisor to automatically restart workers when they crash, while keeping the actual worker process as :transient (so it doesn't restart during coordinated shutdown).
Architecture
DynamicSupervisor (WorkerSupervisor)
└── Worker.Starter (permanent, one per worker)
└── Worker (transient, actual worker process)
When a Worker crashes:
- Worker.Starter detects the crash via its :one_for_one strategy
- Worker.Starter automatically restarts the Worker (because Worker is :permanent in this context)
- Pool is notified via :DOWN message but doesn't need to manage restarts
- New Worker re-registers itself automatically
This decouples the Pool from worker replacement logic.
Summary
Functions
Returns a specification to start this module under a supervisor.
Starts a worker starter supervisor.
Returns a via tuple for this starter supervisor.
Functions
Returns a specification to start this module under a supervisor.
See Supervisor
.
Starts a worker starter supervisor.
Parameters
worker_id
- Unique identifier for the worker
Returns a via tuple for this starter supervisor.