2
0
mirror of https://github.com/hibiken/asynq.git synced 2024-09-20 02:55:54 +08:00

Add CancelActiveTask method to Inspector

This commit is contained in:
Ken Hibino 2020-12-05 06:49:01 -08:00
parent 52d536a8f5
commit c06e9de97d
2 changed files with 9 additions and 0 deletions

View File

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- `CancelActiveTask` method is added to `Inspector`.
- `SchedulerEntries` method is added to `Inspector`. - `SchedulerEntries` method is added to `Inspector`.
- `DeleteQueue` method is added to `Inspector`. - `DeleteQueue` method is added to `Inspector`.

View File

@ -598,6 +598,14 @@ func (i *Inspector) KillTaskByKey(qname, key string) error {
} }
} }
// CancelActiveTask sends a signal to cancel processing of the task with
// the given id. CancelActiveTask is best-effort, which means that it does not
// guarantee that the task with the given id will be canceled. The return
// value only indicates whether the cancelation signal has been sent.
func (i *Inspector) CancelActiveTask(id string) error {
return i.rdb.PublishCancelation(id)
}
// PauseQueue pauses task processing on the specified queue. // PauseQueue pauses task processing on the specified queue.
// If the queue is already paused, it will return a non-nil error. // If the queue is already paused, it will return a non-nil error.
func (i *Inspector) PauseQueue(qname string) error { func (i *Inspector) PauseQueue(qname string) error {