Refactor vendor mappings to canonical PN catalog
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user