Configurable background task execution

This commit is contained in:
Lorenzo Bolla committed 2022-01-27 09:30:14 +01:00
1 parent bd4c3a246d
commit 9b28d8984f
18 files changed
+427 -214

No files matched your search

+9 -7
View File
@@ -1,6 +1,7 @@
package task
import (
"github.com/aptly-dev/aptly/aptly"
"sync/atomic"
)
@@ -20,7 +21,7 @@ type PublishDetail struct {
}
// Process is a function implementing the actual task logic
type Process func(out *Output, detail *Detail) error
type Process func(out aptly.Progress, detail *Detail) (int, error)
const (
// IDLE when task is waiting
@@ -35,12 +36,13 @@ const (
// Task represents as task in a queue encapsulates process code
type Task struct {
output *Output
detail *Detail
process Process
Name string
ID int
State State
output *Output
detail *Detail
process Process
processReturnCode int
Name string
ID int
State State
}
// NewTask creates new task