All Projects â†’ go-playground â†’ kms

go-playground / kms

Licence: MIT license
🔪 Is a library that aids in graceful shutdown of a process/application

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to kms

python-graceful-shutdown
Example of a Python code that implements graceful shutdown while using asyncio, threading and multiprocessing
Stars: ✭ 109 (+147.73%)
Mutual labels:  graceful-shutdown
zerodown
Graceful restart & zero downtime deploy for Go servers.
Stars: ✭ 36 (-18.18%)
Mutual labels:  graceful-shutdown
lifecycle-manager
Graceful AWS scaling event on Kubernetes using lifecycle hooks
Stars: ✭ 89 (+102.27%)
Mutual labels:  graceful-shutdown
http-graceful-shutdown
Gracefully terminates HTTP servers in Node.js
Stars: ✭ 79 (+79.55%)
Mutual labels:  graceful-shutdown
breaker
🚧 Flexible mechanism to make execution flow interruptible.
Stars: ✭ 100 (+127.27%)
Mutual labels:  graceful-shutdown
sigctx
Go contexts for graceful shutdown
Stars: ✭ 55 (+25%)
Mutual labels:  graceful-shutdown
node-graceful-shutdown
Gracefully shutdown your modular NodeJS application.
Stars: ✭ 20 (-54.55%)
Mutual labels:  graceful-shutdown
hiatus-spring-boot
No description or website provided.
Stars: ✭ 23 (-47.73%)
Mutual labels:  graceful-shutdown

KMS

Project status Build Status Coverage Status Go Report Card GoDoc License

KMS(Killing Me Softly) is a library that aids in graceful shutdown of a process/application.

Why does this even exist? Aren't there other graceful shutdown librarys?

Sure there are other libraries, but they are focused on handling graceful shutdown a specific portion of code such as graceful shutdown of an http server, but this library allows you to glue together multiple unrelated(or related) services running within the same process/application.

Doesn't Go 1.8 handle graceful shutdown?

Yes and No, it does not yet handle Hijacked connections, like WebSockets, see:

but this package does; furthermore this package isn't just for graceful http shutdown but graceful shutdown of anything and everything.

When Go 1.8 comes out I will transparently make changes to let the std lib handle idle connections as it has lower level access to them, but continue to handle Hijacked connections.

Installation

Use go get

go get -u github.com/go-playground/kms

Built In

There are a few built in graceful shutdown helpers using the kms package for:

  • TCP
  • Unix Sockets
  • HTTP(S) graceful shutdown.

Examples

see here for more

package main

import (
	"net/http"
	"time"

	"github.com/go-playground/kms"
	"github.com/go-playground/kms/kmsnet/kmshttp"
)

func main() {

	// listen for shutdown signal(s) with timeout, non-blocking
	kms.ListenTimeout(false, time.Minute*3)

	http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
		w.Write([]byte("Home"))
	})

	kmshttp.ListenAndServe(":3007", nil)
}

Package Versioning

I'm jumping on the vendoring bandwagon, you should vendor this package as I will not be creating different version with gopkg.in like allot of my other libraries.

Why? because my time is spread pretty thin maintaining all of the libraries I have + LIFE, it is so freeing not to worry about it and will help me keep pouring out bigger and better things for you the community.

I am open versioning with gopkg.in should anyone request it, but this should be stable going forward.

Licenses

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].