gopool

package
v2.0.15 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 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

func WithMaxIdleTimeoutSeconds(seconds int64) Option

func WithPanicHandler

func WithPanicHandler(panicHandler func(err any)) 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

func (p *Pool) FailedTotal() uint64

FailedTotal _

func (*Pool) HandleTotal

func (p *Pool) HandleTotal() uint64

HandleTotal _

func (*Pool) PendingTaskTotal

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

func (p *Pool) SuccessTotal() uint64

SuccessTotal _

Jump to

Keyboard shortcuts

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