queue

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// GoroutinePoolSize maximum number of running goroutine instances.
	GoroutinePoolSize int `yaml:"goroutinePoolSize" json:"goroutinePoolSize"`
	// Size size of queue. If it exhausted Submit returns error.
	Size int `yaml:"size" json:"size"`
	// MaxIdleTime sets up the interval time of cleaning up goroutines, 0 means never cleanup.
	MaxIdleTime time.Duration `yaml:"maxIdleTime" json:"maxIdleTime"`
}

Config configuration for task queue.

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults set zero values to defautls.

type Queue

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

Queue representation of task queue.

func New

func New(cfg Config) (*Queue, error)

New creates task queue which is processed by goroutines.

func (*Queue) Release

func (q *Queue) Release()

Release closes queue and release it.

func (*Queue) Submit

func (q *Queue) Submit(tasks ...func()) error

Submit appends and execute task by Queue.

Jump to

Keyboard shortcuts

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