processutils

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_MAX_TRY_COUNT                   = 3
	DEFAULT_POST_START_BURST_PAUSE_DURATION = 5 * time.Minute

	NEW_PROCESS_PID_LOG_FIELD_NAME = "newProcessPID"
)

Variables

This section is empty.

Functions

func AutoRestart

func AutoRestart(args AutoRestartArgs) error

AutoRestart starts a restart loop in the calling goroutine, during a single step args.MakeCommand is called and the returned command is started.

func KillHiearachy

func KillHiearachy(pid int, logger zerolog.Logger)

Types

type AutoRestartArgs

type AutoRestartArgs struct {
	GoCtx       context.Context
	MakeCommand func(goCtx context.Context) *exec.Cmd

	Logger            zerolog.Logger
	ProcessNameInLogs string

	//defaults to DEFAULT_MAX_TRY_COUNT
	MaxTryCount int

	//optional, an item is written to this channel each time a created process exits.
	ExitEventChan chan struct{}

	//optional, each time a process is started its PID is written to the channel.
	StartEventChan chan int32

	//duration of the pause following a burst of failed starts, defaults to DEFAULT_POST_START_BURST_PAUSE_DURATION.
	PostStartBurstPauseDuration time.Duration

	//optional, the value is set to true when the autorestart is paused
	PostStartBurstPause *atomic.Bool
}

Jump to

Keyboard shortcuts

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