queue sync calls

This commit is contained in:
André Roth
2024-06-08 12:27:59 +02:00
parent efc5573b8e
commit 3e1485faf5
3 changed files with 24 additions and 3 deletions

View File

@@ -56,6 +56,7 @@ func (list *List) consumer() {
list.Lock()
{
task.processReturnValue = retValue
task.err = err
if err != nil {
task.output.Printf("Task failed with error: %v", err)
task.State = FAILED
@@ -241,3 +242,14 @@ func (list *List) WaitForTaskByID(ID int) (Task, error) {
wgTask.Wait()
return list.GetTaskByID(ID)
}
// GetTaskError returns the Task error for a given id
func (list *List) GetTaskErrorByID(ID int) (error, error) {
task, err := list.GetTaskByID(ID)
if err != nil {
return nil, err
}
return task.err, nil
}

View File

@@ -47,6 +47,7 @@ type Task struct {
detail *Detail
process Process
processReturnValue *ProcessReturnValue
err error
Name string
ID int
State State