Fail transitions to s and records err as the last error. Use this when entering Failed/Restarting after a failure so the supervisor's snapshot surfaces a useful message.
(s State, err error)
| 107 | // entering Failed/Restarting after a failure so the supervisor's snapshot |
| 108 | // surfaces a useful message. |
| 109 | func (t *Tracker) Fail(s State, err error) { |
| 110 | t.mu.Lock() |
| 111 | defer t.mu.Unlock() |
| 112 | t.state = s |
| 113 | t.since = time.Now() |
| 114 | t.lastErr = err |
| 115 | } |
| 116 | |
| 117 | // IncRestarts increments the restart counter and returns the new value. |
| 118 | func (t *Tracker) IncRestarts() int { |