common

package
v0.3.7-rc.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TaskQueue

type TaskQueue struct {
	// contains filtered or unexported fields
}

TaskQueue is rate limiting queue for task

func NewTaskQueue

func NewTaskQueue(taskName string, maxRetries int) *TaskQueue

NewTaskQueue creates a queue maxRetries limit retry number, no limit if maxRetries=0 1s, 2s, 4s, 8s, 16s, 32s, 60s, 60s, 60s, ...

func (*TaskQueue) Add

func (q *TaskQueue) Add(task string)

Add a task into the queue

func (*TaskQueue) AddRateLimited

func (q *TaskQueue) AddRateLimited(task string)

AddRateLimited a task

func (*TaskQueue) Done

func (q *TaskQueue) Done(task string)

Done completes the task and remove from the queue

func (*TaskQueue) Forget

func (q *TaskQueue) Forget(task string)

Forget cleanup the rate limit on the task

func (*TaskQueue) Get

func (q *TaskQueue) Get() (string, bool)

Get a task from queue. It's a blocking call

func (*TaskQueue) NumRequeues

func (q *TaskQueue) NumRequeues(task string) int

NumRequeues get number of task retried

func (*TaskQueue) Shutdown

func (q *TaskQueue) Shutdown()

Shutdown the queue

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL