mirror of
https://github.com/hibiken/asynq.git
synced 2025-09-17 12:20:07 +08:00
Add TaskStateProber to get task state changed events
This commit is contained in:
@@ -53,6 +53,11 @@ const (
|
||||
TaskStateAggregating // describes a state where task is waiting in a group to be aggregated
|
||||
)
|
||||
|
||||
type TaskProber interface {
|
||||
Changed(map[string]interface{})
|
||||
Result(state TaskState, raw *TaskInfo) (string, interface{})
|
||||
}
|
||||
|
||||
func (s TaskState) String() string {
|
||||
switch s {
|
||||
case TaskStateActive:
|
||||
@@ -752,4 +757,7 @@ type Broker interface {
|
||||
PublishCancelation(id string) error
|
||||
|
||||
WriteResult(qname, id string, data []byte) (n int, err error)
|
||||
|
||||
// StateChanged watch state updates, with more customized detail
|
||||
SetTaskProber(prober TaskProber)
|
||||
}
|
||||
|
Reference in New Issue
Block a user