From 14c381dc40856af0ede45370a60f3afbcb0a7547 Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Thu, 28 Jan 2021 16:40:42 -0800 Subject: [PATCH] Update documentation for inspeq package --- inspeq/doc.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 inspeq/doc.go diff --git a/inspeq/doc.go b/inspeq/doc.go new file mode 100644 index 0000000..94b39ad --- /dev/null +++ b/inspeq/doc.go @@ -0,0 +1,31 @@ +// Copyright 2020 Kentaro Hibino. All rights reserved. +// Use of this source code is governed by a MIT license +// that can be found in the LICENSE file. + +/* +Package inspeq provides helper types and functions to inspect queues and tasks managed by Asynq. + +Inspector is used to query and mutate the state of queues. + + inspector := inspeq.New(asynq.RedisConnOpt{Addr: "localhost:6379"}) + + // Query tasks from a queue. + archived, err := inspector.ListArchivedTasks("my_queue") + if err != nil { + // handle error + } + + // Take action on a task. + for _, t := range archived { + if err := inspector.RunTaskByKey(t.Key()); err != nil { + // handle error + } + } + + // Take action on all tasks of a specified state. + n, err := inspector.DeleteAllRetryTasks("my_queue") + if err != nil { + // handle error + } +*/ +package inspeq