worker

package
v2.0.0-alpha28 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// WaitDuration - for how long error buffer should attempt to aggregate error messages
	// before merging output together since lastError update (required to keep error update together).
	WaitDuration = 25 * time.Millisecond

	// ReadBufSize used to make a slice with specified length to read from stderr
	ReadBufSize = 10240 // Kb
)

Variables

This section is empty.

Functions

func From

From creates SyncWorker from BaseProcess

func InitBaseWorker

func InitBaseWorker(cmd *exec.Cmd, options ...Options) (worker.BaseProcess, error)

InitBaseWorker creates new Process over given exec.cmd.

Types

type Options

type Options func(p *Process)

func AddListeners

func AddListeners(listeners ...events.EventListener) Options

type Process

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

Process - supervised process with api over goridge.Relay.

func (*Process) AttachRelay

func (w *Process) AttachRelay(rl relay.Relay)

State return receive-only Process state object, state can be used to safely access Process status, time when status changed and number of Process executions.

func (*Process) Created

func (w *Process) Created() time.Time

Created returns time worker was created at.

func (*Process) Kill

func (w *Process) Kill() error

Kill kills underlying process, make sure to call Wait() func to gather error log from the stderr. Does not waits for process completion!

func (*Process) Pid

func (w *Process) Pid() int64

Pid returns worker pid.

func (*Process) Relay

func (w *Process) Relay() relay.Relay

State return receive-only Process state object, state can be used to safely access Process status, time when status changed and number of Process executions.

func (*Process) Start

func (w *Process) Start() error

func (*Process) State

func (w *Process) State() internal.State

State return receive-only Process state object, state can be used to safely access Process status, time when status changed and number of Process executions.

func (*Process) Stop

func (w *Process) Stop() error

Stop sends soft termination command to the Process and waits for process completion.

func (*Process) String

func (w *Process) String() string

String returns Process description. fmt.Stringer interface

func (*Process) Wait

func (w *Process) Wait() error

Wait must be called once for each Process, call will be released once Process is complete and will return process error (if any), if stderr is presented it's value will be wrapped as WorkerError. Method will return error code if php process fails to find or Start the script.

Jump to

Keyboard shortcuts

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