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.
- Host: GitHub
- URL: https://github.com/bostin/gdown
- Owner: bostin
- License: mit
- Created: 2022-02-16T07:49:57.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2022-06-06T03:27:56.000Z (over 3 years ago)
- Last Synced: 2025-02-05T02:43:11.831Z (8 months ago)
- Topics: golang, golang-tools, graceful-shutdown, shutdown
- Language: Go
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: License
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()
```