workers

package
v1.0.0-beta.98 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MAX_ERROR_COUNT     = 10
	LEASE_TIME          = 1 * time.Minute
	PEAK_JOB_ITEMS      = 5 // number of items to fetch from the queue to see which one to select
	QUEUE_UPDATE_PERIOD = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Complete

type Complete func(item *metadata.QueueItem)

type Event

type Event struct {
	Success  bool
	Item     metadata.QueueItem
	WorkerId uint
}

type Worker

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

func (*Worker) Loop

func (w *Worker) Loop()

func (*Worker) Start

func (w *Worker) Start()

func (*Worker) Stop

func (w *Worker) Stop()

type WorkerInfo

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

type WorkerPool

type WorkerPool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewWorkerPool

func NewWorkerPool(maxWorkers uint, queue *metadata.QueueSubspace, txMgr *transaction.Manager, tenantMgr *metadata.TenantManager, workerSleepTime time.Duration, poolSleepTime time.Duration) *WorkerPool

func (*WorkerPool) Loop

func (pool *WorkerPool) Loop()

func (*WorkerPool) Start

func (pool *WorkerPool) Start() error

func (*WorkerPool) Stop

func (pool *WorkerPool) Stop()

type WorkerTestTask

type WorkerTestTask struct {
	Sleep            time.Duration `json:"sleep"`
	NumErrors        int           `json:"error_count"`
	ShouldStopWorker bool          `json:"should_stop_worker"`
}

Jump to

Keyboard shortcuts

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