common

package
v0.15.4 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RestRequestRoutes

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

RestRequestRoutes is the routes for Rest Request

func (*RestRequestRoutes) AddToRoutes

func (r *RestRequestRoutes) AddToRoutes(routes []Route)

AddToRoutes adds more routes

func (*RestRequestRoutes) Routes

func (r *RestRequestRoutes) Routes() []Route

Routes gets routes

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

Route defines a rest api

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