Skip to content
This repository was archived by the owner on Sep 5, 2019. It is now read-only.

Building the next major version of graceful #78

Closed
F21 opened this issue Jun 29, 2016 · 5 comments
Closed

Building the next major version of graceful #78

F21 opened this issue Jun 29, 2016 · 5 comments

Comments

@F21
Copy link
Collaborator

F21 commented Jun 29, 2016

@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:

  1. Simple, clean, concise public API.
  2. Works with any server, like it does now.
  3. Supports HTTP 2
  4. Robust, correct, clean tests.
  5. NOT supporting zero-downtime restarts, there are other packages for that.
@awalterschulze
Copy link

awalterschulze commented Sep 21, 2016

Might you consider allowing the addition of context which is now included in go1.7
I can catch the os signals myself and call the cancel function.

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()

@F21
Copy link
Collaborator Author

F21 commented Sep 21, 2016

@awalterschulze I think that's a great idea! Would you be interested in working on a PR?

@pkieltyka
Copy link

pkieltyka commented Oct 9, 2016

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.

@F21
Copy link
Collaborator Author

F21 commented Oct 31, 2016

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)

@tylerstillwater
Copy link
Owner

Fantastic!

On Oct 30, 2016, 5:27 PM -0700, Francis Chuang [email protected], wrote:

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) (golang/go#4674 (comment))


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub (#78 (comment)), or mute the thread (https://github.com/notifications/unsubscribe-auth/AAEUlGQPDbuKKdnPjmSewq5_DzuyB3rXks5q5TX3gaJpZM4JAwfv).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants