BackoffOptions
Defined in: src/pattern/BackoffSupervisor.ts:110
Type Parameters
Section titled “Type Parameters”T
Properties
Section titled “Properties”childName?
Section titled “childName?”
readonlyoptionalchildName?:string
Defined in: src/pattern/BackoffSupervisor.ts:116
Name suffix for the child. The actual child name is
${childName}-${incarnation} so successive incarnations don’t
collide on names while the previous instance is still tearing down.
childProps
Section titled “childProps”
readonlychildProps:Props<T>
Defined in: src/pattern/BackoffSupervisor.ts:112
How to construct the child.
clock?
Section titled “clock?”
readonlyoptionalclock?: () =>number
Defined in: src/pattern/BackoffSupervisor.ts:169
Override Date.now/Math.random for deterministic tests.
Returns
Section titled “Returns”number
drainGraceMs?
Section titled “drainGraceMs?”
readonlyoptionaldrainGraceMs?:number
Defined in: src/pattern/BackoffSupervisor.ts:146
Grace period after a respawn before stashed messages are forwarded
to the new child. This protects buffered messages against children
that crash in preStart — if the child dies during the grace
window, the stash is preserved for the next incarnation.
Default: min(50ms, minBackoff). Set 0 to disable (drain
immediately on spawn — the v0 behaviour).
forward?
Section titled “forward?”
readonlyoptionalforward?:ForwardStrategy
Defined in: src/pattern/BackoffSupervisor.ts:128
What to do with messages while the child is dead. Default 'stash'.
forwardDuringGrace?
Section titled “forwardDuringGrace?”
readonlyoptionalforwardDuringGrace?:boolean
Defined in: src/pattern/BackoffSupervisor.ts:167
What to do with messages that arrive during the grace window
(after a respawn, before the child has proven it survives
drainGraceMs). Two modes (#67):
true(default) — v1 behaviour. New messages forward immediately to the about-to-be-confirmed child; if that child dies inpreStart, those forwarded messages dead-letter. Lowest latency on the happy path, accepts dead-letters during a preStart-crash cascade.false— strict mode. New messages stash until the grace expires, then drain alongside the carry-over stash from the previous incarnation. Costs up todrainGraceMsof latency on the first messages after a respawn but guarantees nothing dead-letters when the child keeps crashing inpreStart. Opt-in to fix the dead-letter cascade described in #67.
Has no effect when drainGraceMs === 0 — without a grace there
is no “uncertain” window for the gate to apply to.
maxBackoff
Section titled “maxBackoff”
readonlymaxBackoff:number
Defined in: src/pattern/BackoffSupervisor.ts:120
Ceiling for the backoff delay, in ms. Must be >= minBackoff.
maxStashSize?
Section titled “maxStashSize?”
readonlyoptionalmaxStashSize?:number
Defined in: src/pattern/BackoffSupervisor.ts:136
Stash buffer size (only when forward === 'stash'). Default 1000.
minBackoff
Section titled “minBackoff”
readonlyminBackoff:number
Defined in: src/pattern/BackoffSupervisor.ts:118
Floor for the backoff delay, in ms. Must be > 0.
policy?
Section titled “policy?”
readonlyoptionalpolicy?:BackoffPolicy
Defined in: src/pattern/BackoffSupervisor.ts:124
Custom policy — overrides the default exponential backoff.
randomFactor?
Section titled “randomFactor?”
readonlyoptionalrandomFactor?:number
Defined in: src/pattern/BackoffSupervisor.ts:122
Jitter fraction in [0, 1]. Default 0.2.
resetCounter?
Section titled “resetCounter?”
readonlyoptionalresetCounter?:ResetCounter
Defined in: src/pattern/BackoffSupervisor.ts:126
Counter-reset rule. Default 'after-min-stable'.
triggerOn?
Section titled “triggerOn?”
readonlyoptionaltriggerOn?:TerminationTrigger
Defined in: src/pattern/BackoffSupervisor.ts:134
Which terminations should trigger a respawn. Default 'any'
(current v1 behaviour: respawn on crash AND on clean stop).
See TerminationTrigger for the three modes.