(ctx context.Context, sessionID string, reason taskpkg.StopReason)
| 314 | } |
| 315 | |
| 316 | func (b *taskSessionBridge) ForceTaskStop(ctx context.Context, sessionID string, reason taskpkg.StopReason) error { |
| 317 | if ctx == nil { |
| 318 | return errors.New("daemon: force task stop context is required") |
| 319 | } |
| 320 | |
| 321 | trimmedID := strings.TrimSpace(sessionID) |
| 322 | if trimmedID == "" { |
| 323 | return fmt.Errorf("%w: task session stop id is required", taskpkg.ErrValidation) |
| 324 | } |
| 325 | |
| 326 | if err := b.sessions.StopWithCause(ctx, trimmedID, taskStopCause(reason), taskStopDetail(reason)); err != nil { |
| 327 | if errors.Is(err, session.ErrSessionNotFound) { |
| 328 | return nil |
| 329 | } |
| 330 | return err |
| 331 | } |
| 332 | return nil |
| 333 | } |
| 334 | |
| 335 | func (d *Daemon) bootTasks(ctx context.Context, state *bootState) error { |
| 336 | if state == nil || state.registry == nil || state.sessions == nil { |
no test coverage detected