Back to

Package subprocessmanager

Latest Go to latest

The highest tagged major version is .



const (
	// HealthyProcessTime is the default time a process needs to stay alive to be considered healthy
	HealthyProcessTime time.Duration = 30 * time.Minute
	// HealthyCrashCount is the amount of times a process can crash (within the healthyProcessTime) before being considered unstable - it may be trying to find a port
	HealthyCrashCount int = 3

func GetDelay

func GetDelay(elapsed time.Duration, crashCount int) time.Duration

GetDelay will compute the delay for a given process according to its crash count and time alive using an exponential backoff algorithm

type EnvConfig

type EnvConfig struct {
	// Name is the name of the environment variable
	Name string `mapstructure:"name"`
	// Value is the value of the variable
	Value string `mapstructure:"value"`

EnvConfig is the config definition of each key-value pair for environment variables

type Process

type Process struct {
	Command string
	Port    int
	Env     []EnvConfig

Process struct holds all the info needed to instantiate a subprocess

func (*Process) Run

func (proc *Process) Run(logger *zap.Logger) (time.Duration, error)

Run will start the process and keep track of running time

type SubprocessConfig

type SubprocessConfig struct {
	// Command is the command to be run (binary + flags, separated by commas)
	Command string `mapstructure:"exec"`
	// Port is the port assigned to the Receiver, and to the {{port}} template variables
	Port int `mapstructure:"port"`
	// Env is a list of env variables to pass to a specific command
	Env []EnvConfig `mapstructure:"env"`

SubprocessConfig is the config definition for the subprocess manager

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier