worker_watcher

package
v2.0.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWorkerWatcher

func NewWorkerWatcher(allocator worker.Allocator, numWorkers int64, events events.Handler) worker.Watcher

workerCreateFunc can be nil, but in that case, dead stack will not be replaced

Types

type Stack

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

func NewWorkersStack

func NewWorkersStack() *Stack

func (*Stack) Destroy

func (stack *Stack) Destroy(ctx context.Context)

we also have to give a chance to pool to Push worker (return it)

func (*Stack) FindAndRemoveByPid

func (stack *Stack) FindAndRemoveByPid(pid int64) bool

func (*Stack) IsEmpty

func (stack *Stack) IsEmpty() bool

func (*Stack) Pop

func (stack *Stack) Pop() (worker.BaseProcess, bool)

func (*Stack) Push

func (stack *Stack) Push(w worker.BaseProcess)

Push worker back to the stack If stack in destroy state, Push will provide 100ms window to unlock the mutex

func (*Stack) Reset

func (stack *Stack) Reset()

func (*Stack) Workers

func (stack *Stack) Workers() []worker.BaseProcess

Workers return copy of the workers in the stack

Jump to

Keyboard shortcuts

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