workpool

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CustomControllerRateLimiter

func CustomControllerRateLimiter(qps int, bucketNum int) workqueue.RateLimiter

Types

type FuncResult

type FuncResult struct {
	Result interface{}
	Err    error
}

FuncResult struct

type GoRoutineExecutor

type GoRoutineExecutor struct {
	TaskID string
	GoRoutineFunc
	GoRoutineParams []interface{}
}

GoRoutineExecutor body

type GoRoutineFunc

type GoRoutineFunc func(params ...interface{}) (interface{}, error)

GoRoutineFunc process func

type GoRoutinePool

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

GoRoutinePool go routine pool

func NewRateLimitedGoRoutinePool

func NewRateLimitedGoRoutinePool(size int, stopCH <-chan struct{}, ctx context.Context, qps int, bucketNum int) *GoRoutinePool

NewRateLimitedGoRoutinePool bucketNum 默认最好为1, 这样qps才会准确

func (*GoRoutinePool) Run

func (p *GoRoutinePool) Run() []interface{}

Run pool

func (*GoRoutinePool) Submit

func (p *GoRoutinePool) Submit(executor GoRoutineExecutor)

Submit task

Jump to

Keyboard shortcuts

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