grace

package
v0.0.74 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Orchestrate

func Orchestrate(options OrchestrateOptions)

Orchestrate manages the core lifecycle of an application, including startup, shutdown, and os signal handling.

func TerminateProcess

func TerminateProcess(process *os.Process, timeToWait time.Duration, logger *slog.Logger) error

TerminateProcess attempts to gracefully terminate a process, falling back to force kill after timeout. If logger is nil, defaults to stdout.

Types

type OrchestrateOptions

type OrchestrateOptions struct {
	ShutdownTimeout  time.Duration // Default: 30 seconds
	Signals          []os.Signal   // Default: SIGHUP, SIGINT, SIGTERM, SIGQUIT
	Logger           *slog.Logger  // Default: os.Stdout
	StartupCallback  func() error
	ShutdownCallback func(context.Context) error
}

Jump to

Keyboard shortcuts

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