Stop stops the toolset if it implements Startable and resets the started flag so that a subsequent Start will re-initialize.
(ctx context.Context)
| 210 | // Stop stops the toolset if it implements Startable and resets |
| 211 | // the started flag so that a subsequent Start will re-initialize. |
| 212 | func (s *StartableToolSet) Stop(ctx context.Context) error { |
| 213 | s.mu.Lock() |
| 214 | defer s.mu.Unlock() |
| 215 | |
| 216 | s.started = false |
| 217 | s.startStreak.reset() |
| 218 | s.listStreak.reset() |
| 219 | s.recoveryStreak.reset() |
| 220 | if startable, ok := As[Startable](s.ToolSet); ok { |
| 221 | return startable.Stop(ctx) |
| 222 | } |
| 223 | return nil |
| 224 | } |
| 225 | |
| 226 | // ShouldReportFailure returns true exactly once per failure streak — after |
| 227 | // the first failed Start() and before the streak ends (a successful |