Skip to main content

What is supervision?

Every actor has a parent. When a child fails (panics, returns an error from a handler), the parent’s supervisor decides what to do. This keeps failures localized and recoverable.

Strategies

Choose OneForOne when failures are independent; OneForAll when siblings share critical state.

Directives

Configure retry windows (max retries within a time period) to avoid infinite restart loops. After the window is exceeded, the supervisor can escalate.

Supervisor configuration

Supervisors are created with supervisor.NewSupervisor(opts...) and passed via WithSupervisor when spawning. Key options: Directives: Resume, Restart, Stop, Escalate. When the retry window is exceeded, the supervisor escalates to the grandparent.