lifecycle

package
v1.0.20 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 7 Imported by: 6

Documentation

Overview

Package lifecycle provides variables for controlling an application's lifecycle, and a function for gracefully shutting down an http.Server.

It exposes these variables with two HTTP handlers:

/live
/ready

The package is sometimes only imported for the side effect of registering its HTTP handlers. To use it this way, link this package into your program:

import _ "github.com/skuid/spec/lifecycle"

When not using the default multiplexer in the http.ListenAndServe function call, the handlers are available for adding separately.

Index

Constants

This section is empty.

Variables

View Source
var Ready = true

Ready is a boolean that represents whether the application is ready.

View Source
var Shutdown = false

Shutdown is a boolean that represents whether the application has received a SIGTERM.

View Source
var ShutdownTimer int64 = 15

ShutdownTimer is a configuration option for this package that sets the amount of time in seconds an application should wait before exiting after receiving a SIGTERM.

Functions

func LivenessHandler

func LivenessHandler(w http.ResponseWriter, r *http.Request)

LivenessHandler reports on the status of Shutdown

func ReadinessHandler

func ReadinessHandler(w http.ResponseWriter, r *http.Request)

ReadinessHandler reports on the status of Ready

func ShutdownOnTerm

func ShutdownOnTerm(srv *http.Server)

ShutdownOnTerm accepts an *http.Server and will gracefully shut it down when a SIGTERM is received, after ShutdownTimer seconds (default 15)

Types

This section is empty.

Jump to

Keyboard shortcuts

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