mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-06 05:30:57 +00:00
Configurable background task execution
This commit is contained in:
+9
-7
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user