grace

package module
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2019 License: MIT Imports: 4 Imported by: 14

README

Grace pkg

Package with single function for create base context which will be canceled on signals: SIGINT, SIGTERM, SIGHUP.

Example

package main

import (
    "context"

    "github.com/chapsuk/grace"
)

func main() {
    ctx := grace.ShutdownContext(context.Background())
    <-ctx.Done()
    // do graceful shutdown after context was canceled
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShutdownContext

func ShutdownContext(c context.Context) context.Context

ShutdownContext returns child context from passed context which will be canceled on incoming signals: SIGINT, SIGTERM, SIGHUP. Ends immediately by os.Exit(1) after second signal

Types

This section is empty.

Jump to

Keyboard shortcuts

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