serverutils

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GracefulShutdownSystem

func GracefulShutdownSystem(
	ctx context.Context,
	appLogger logger.Logger,
	errCh <-chan error,
	timeout time.Duration,
	shutdownTasks []ShutdownTask,
) <-chan struct{}

GracefulShutdownSystem waits for OS signal or error then runs provided shutdown tasks in the given order within the specified timeout. It returns a channel that's closed once all tasks complete or the timeout elapses.

Types

type ShutdownOperation

type ShutdownOperation func(ctx context.Context) error

ShutdownOperation defines a function type for shutdown operations

type ShutdownTask added in v0.17.0

type ShutdownTask struct {
	Name string
	Op   ShutdownOperation
}

ShutdownTask represents a task to be executed during graceful shutdown

Jump to

Keyboard shortcuts

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