コンテンツにスキップ
日本語

TerminationTrigger

このコンテンツはまだ日本語訳がありません。

TerminationTrigger = "any" | "failure" | "stop"

Defined in: src/pattern/BackoffSupervisorOptions.ts:47

Which terminations should trigger a respawn (#68). Two modes, because the right answer depends on whether you treat a clean self-stop as recoverable or as a deliberate end of life:

  • 'any' (default) — respawn on every termination, whether the child crashed (uncaught throw) or stopped itself cleanly (context.stop(self), PoisonPill, parent-driven stop). This is the original v1 (#48) behaviour.
  • 'failure' — respawn only when the child crashed. A clean self-stop is taken as “this child is done”; the supervisor itself stops afterwards instead of spawning a replacement.
  • 'stop' — the inverse: respawn only on clean stops (e.g. a transient connection actor that periodically tears itself down). Crashes propagate “up” by stopping the supervisor.

Matching is on the last termination only — the supervisor re-arms its tracking on every respawn, so a string of crashes followed by a clean stop in 'failure' mode would respawn through each crash and then stop on the clean stop.