gopool

package
v1.3.8 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrSubmitTimeout    = errors.New("submit error: timed out")
	ErrOptionsDeadQueue = errors.New("options error:dead queue configuration")
	ErrOptionsSpawn     = errors.New("options error:spawn > workers")
)

Functions

This section is empty.

Types

type Option

type Option func(opts *Options)

func WithMaxIdleTimeoutSeconds added in v1.3.0

func WithMaxIdleTimeoutSeconds(seconds int64) Option

func WithPanicHandler

func WithPanicHandler(panicHandler func(err interface{})) Option

WithPanicHandler set panicHandler

func WithQueueLength

func WithQueueLength(length int) Option

WithQueueLength set queue length

func WithSpawnSize

func WithSpawnSize(size int) Option

WithSpawnSize set spawn size

type Options

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

type Pool

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

Pool goroutine pool

func NewPool

func NewPool(maxWorkerNum int, opts ...Option) (*Pool, error)

func (*Pool) ActiveWorkerNum

func (p *Pool) ActiveWorkerNum() int64

ActiveWorkerNum get active worker number

func (*Pool) FailedTotal added in v1.1.16

func (p *Pool) FailedTotal() uint64

FailedTotal _

func (*Pool) HandleTotal added in v1.1.16

func (p *Pool) HandleTotal() uint64

HandleTotal _

func (*Pool) PendingTaskTotal added in v1.1.16

func (p *Pool) PendingTaskTotal() int64

PendingTaskTotal get pending task num

func (*Pool) QueueLength

func (p *Pool) QueueLength() int64

QueueLength get queue item number

func (*Pool) Submit

func (p *Pool) Submit(task func()) error

Submit _

func (*Pool) SubmitTimeout

func (p *Pool) SubmitTimeout(timeout time.Duration, task func()) error

SubmitTimeout _

func (*Pool) SuccessTotal added in v1.1.16

func (p *Pool) SuccessTotal() uint64

SuccessTotal _

Jump to

Keyboard shortcuts

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