Documentation ¶
Index ¶
- Constants
- func DefaultRetryFunc(ctx context.Context, key string, timesTried int, originallyAdded time.Time, ...) (*time.Duration, error)
- type ItemHandler
- type Queue
- func (q *Queue) Empty() bool
- func (q *Queue) Enqueue(ctx context.Context, key string)
- func (q *Queue) EnqueueWithoutRateLimit(ctx context.Context, key string)
- func (q *Queue) EnqueueWithoutRateLimitWithDelay(ctx context.Context, key string, after time.Duration)
- func (q *Queue) Forget(ctx context.Context, key string)
- func (q *Queue) Len() int
- func (q *Queue) Run(ctx context.Context, workers int)
- func (q *Queue) String() string
- type ShouldRetryFunc
Constants ¶
View Source
const (
// MaxRetries is the number of times we try to process a given key before permanently forgetting it.
MaxRetries = 20
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ItemHandler ¶
ItemHandler is a callback that handles a single key on the Queue
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
Queue implements a wrapper around workqueue with native VK instrumentation
func New ¶
func New(ratelimiter workqueue.RateLimiter, name string, handler ItemHandler, retryFunc ShouldRetryFunc) *Queue
New creates a queue
It expects to get a item rate limiter, and a friendly name which is used in logs, and in the internal kubernetes metrics. If retryFunc is nil, the default retry function.
func (*Queue) Empty ¶
Empty returns if the queue has no items in it
It should only be used for debugging.
func (*Queue) EnqueueWithoutRateLimit ¶
EnqueueWithoutRateLimit enqueues the key without a rate limit
func (*Queue) EnqueueWithoutRateLimitWithDelay ¶
func (q *Queue) EnqueueWithoutRateLimitWithDelay(ctx context.Context, key string, after time.Duration)
EnqueueWithoutRateLimitWithDelay enqueues without rate limiting, but work will not start for this given delay period
Click to show internal directories.
Click to hide internal directories.