diff --git a/CHANGELOG.md b/CHANGELOG.md index fff8f30..1650fc0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- `CancelActiveTask` method is added to `Inspector`. - `SchedulerEntries` method is added to `Inspector`. - `DeleteQueue` method is added to `Inspector`. diff --git a/inspector.go b/inspector.go index 2e92961..8ad8ee5 100644 --- a/inspector.go +++ b/inspector.go @@ -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. // If the queue is already paused, it will return a non-nil error. func (i *Inspector) PauseQueue(qname string) error {