Stop stops the loop for a specific PRD immediately.
(name string)
| 360 | |
| 361 | // Stop stops the loop for a specific PRD immediately. |
| 362 | func (m *Manager) Stop(name string) error { |
| 363 | m.mu.RLock() |
| 364 | instance, exists := m.instances[name] |
| 365 | m.mu.RUnlock() |
| 366 | |
| 367 | if !exists { |
| 368 | return fmt.Errorf("PRD %s not found", name) |
| 369 | } |
| 370 | |
| 371 | instance.mu.Lock() |
| 372 | defer instance.mu.Unlock() |
| 373 | |
| 374 | if instance.State != LoopStateRunning && instance.State != LoopStatePaused { |
| 375 | return nil // Already stopped |
| 376 | } |
| 377 | |
| 378 | if instance.Loop != nil { |
| 379 | instance.Loop.Stop() |
| 380 | } |
| 381 | if instance.cancel != nil { |
| 382 | instance.cancel() |
| 383 | } |
| 384 | |
| 385 | instance.State = LoopStateStopped |
| 386 | |
| 387 | return nil |
| 388 | } |
| 389 | |
| 390 | // UpdateWorktreeInfo updates the worktree directory and branch for an existing PRD instance. |
| 391 | func (m *Manager) UpdateWorktreeInfo(name, worktreeDir, branch string) error { |
no outgoing calls