Skip to content
/ grace Public

A graceful shutdown implementation for Go 🧨

Notifications You must be signed in to change notification settings

msrexe/grace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Grace

Grace is graceful shutdown implementation for Go.

Installation

go get github.com/msrexe/grace

Example

func main() {
	go func() {
		grace.ShutdownWithTimeout(5*time.Second, func() {
			log.Println("Application gracefully stopped")
		})
	}()

	for {
		log.Println("Hello World")
		time.Sleep(2 * time.Second)
	}
}

For more examples, look at the example directory.

About

A graceful shutdown implementation for Go 🧨

Topics

Resources

Stars

Watchers

Forks

Languages