shutdown

package
v0.0.0-...-c7e2dc1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const TIMEOUT_SECONDS float64 = 1

Variables

This section is empty.

Functions

func OnShutdown

func OnShutdown(key string, f func())

Receives functions to run as goroutines on shutdown. If f is nil, the function registered under key is removed. If the shutdown has already started, the function will be run immediately. As such, it is idiomatic to use `defer shutdown.OnShutdown("key", func() { ... })` to ensure the function isn't run too early.

func Shutdown

func Shutdown(reason string, logLevel slog.Level, logger *slog.Logger) bool

Returns true if and only if the shutdown was requested by this call. If false, we were already shutting down. Calls logFunc(reason) if and only if the shutdown was requested by this call.

func WaitForShutdown

func WaitForShutdown()

Blocks until shutdown is requested, but only on the first call. Subsequent calls have no effect and return immediately.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳