mirror of
https://github.com/hibiken/asynq.git
synced 2025-09-20 05:37:17 +08:00
Add StateChanged(func(map[string]interface{}), more ...string) to client and server, to watch state updates with more customized detail, e.g. "completed:result" as default, e.g. pending:next\|task\|message\|result
This commit is contained in:
11
client.go
11
client.go
@@ -150,9 +150,9 @@ func (t deadlineOption) Value() interface{} { return time.Time(t) }
|
||||
// TTL duration must be greater than or equal to 1 second.
|
||||
//
|
||||
// Uniqueness of a task is based on the following properties:
|
||||
// - Task Type
|
||||
// - Task Payload
|
||||
// - Queue Name
|
||||
// - Task Type
|
||||
// - Task Payload
|
||||
// - Queue Name
|
||||
func Unique(ttl time.Duration) Option {
|
||||
return uniqueOption(ttl)
|
||||
}
|
||||
@@ -426,3 +426,8 @@ func (c *Client) addToGroup(ctx context.Context, msg *base.TaskMessage, group st
|
||||
}
|
||||
return c.broker.AddToGroup(ctx, msg, group)
|
||||
}
|
||||
|
||||
// StateChanged watchs state updates, with more customized detail
|
||||
func (c *Client) StateChanged(handler func(map[string]interface{}), more ...string) error {
|
||||
return c.broker.StateChanged(handler, more...)
|
||||
}
|
||||
|
Reference in New Issue
Block a user