An open API service indexing awesome lists of open source software.

https://github.com/bostin/gdown

a graceful shutdown tool.
https://github.com/bostin/gdown

golang golang-tools graceful-shutdown shutdown

Last synced: 7 months ago
JSON representation

a graceful shutdown tool.

Awesome Lists containing this project

README

          

## GDown

a graceful shutdown tool.

## Install

```shell
go get -u github.com/bostin/gdown
```

## Usage

```go
// declare shutdown
ctx, cancel := context.WithCancel(context.Background())
shutdown := gdown.NewGraceful(ctx, cancel)

// register callbacks
shutdown.Register(gdown.PriorityLevel10, func() {
// called on shutdown
})

// listening
shutdown.Listen()
```