mirror of
https://github.com/hibiken/asynqmon.git
synced 2025-09-22 06:46:34 +08:00
Add API endpoints to delete scheduled, retry, and dead task
This commit is contained in:
@@ -165,6 +165,19 @@ func newListDeadTasksHandlerFunc(inspector *asynq.Inspector) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func newDeleteTaskHandlerFunc(inspector *asynq.Inspector) http.HandlerFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
qname, key := vars["qname"], vars["task_key"]
|
||||
if err := inspector.DeleteTaskByKey(qname, key); err != nil {
|
||||
// TODO: Handle task not found error and return 404
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
}
|
||||
}
|
||||
|
||||
// getPageOptions read page size and number from the request url if set,
|
||||
// otherwise it returns the default value.
|
||||
func getPageOptions(r *http.Request) (pageSize, pageNum int) {
|
||||
|
Reference in New Issue
Block a user