worker

package
v1.1.0-beta.0...-57a73ea Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool is the worker pool.

func NewPool

func NewPool(ctx context.Context, limit int, name string) *Pool

NewPool creates a new worker pool.

func (*Pool) Apply

func (pool *Pool) Apply() *Worker

Apply gets a worker from the pool.

func (*Pool) HasWorker

func (pool *Pool) HasWorker() bool

HasWorker returns whether the pool has worker.

func (*Pool) Recycle

func (pool *Pool) Recycle(worker *Worker)

Recycle puts a worker back to the pool.

type Worker

type Worker struct {
	ID int64
}

Worker is the worker struct.

Jump to

Keyboard shortcuts

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