Refactor vendor mappings to canonical PN catalog

This commit is contained in:
Mikhail Chusavitin
2026-03-07 23:11:42 +03:00
parent 96572be712
commit 3f26a2935a
25 changed files with 1334 additions and 754 deletions

View File

@@ -114,7 +114,7 @@ func (m *Manager) List() []*Task {
for _, task := range m.tasks {
// Include running tasks or recently completed tasks (within 30 seconds)
if task.Status == TaskStatusRunning ||
(task.DoneAt != nil && task.DoneAt.After(cutoff)) {
(task.DoneAt != nil && task.DoneAt.After(cutoff)) {
tasks = append(tasks, task)
}
}
@@ -144,6 +144,19 @@ func (m *Manager) Get(id string) (*Task, error) {
return task, nil
}
// HasRunning reports whether there is an in-memory running task of the given type.
func (m *Manager) HasRunning(taskType TaskType) bool {
m.mu.RLock()
defer m.mu.RUnlock()
for _, task := range m.tasks {
if task.Type == taskType && task.Status == TaskStatusRunning {
return true
}
}
return false
}
// updateTask safely updates a task using the provided function
func (m *Manager) updateTask(id string, fn func(*Task)) {
m.mu.Lock()