-
Notifications
You must be signed in to change notification settings - Fork 110
Building the next major version of graceful #78
Comments
Might you consider allowing the addition of context which is now included in go1.7 ctx, cancel := context.WithCancel(context.Background())
go func() {
// catch os signal
cancel()
}()
w := sync.WaitGroup{}
w.Add(2)
go func() {
graceful.RunWithContext(ctx, ":3001",10*time.Second,mux)
w.Done()
}()
go func() {
// another background thread
w.Done()
}()
w.Wait() |
@awalterschulze I think that's a great idea! Would you be interested in working on a PR? |
btw, I wrote https://github.com/pressly/valve which I tried to design as an extension to context that provides a shutdown signal and a waitgroup to non-preemptable code blocks, instructing them to finish without just an arbitrary time period. Perhaps something like this could be included directly in a graceful shutdown package. In addition to the list above, it would be nice to see a graceful package like this one, but designed for any kind of server, not just http servers. An http-specific api would make sense since its so common, but the library should have functions to catch signals and managing the shutdown for anything. |
We may not have to build the next version of Graceful as net/http will probably come with graceful shutdown in Go 1.8: golang/go#4674 (comment) |
Fantastic! On Oct 30, 2016, 5:27 PM -0700, Francis Chuang [email protected], wrote:
|
@tylerb mentioned that it is probably a good time to build the next version of graceful with all the lessons learnt while maintaining the library and using it in production. This might be a complete rewrite, or we could refactor it to the next version. We are now interested in what the community would like to see in the next version as well as any feedback you may have.
For starters, these are what we care about the most:
The text was updated successfully, but these errors were encountered: