braintree / manners

A polite Go HTTP server that shuts down gracefully.
MIT License
997 stars 103 forks source link

Has global state, can only have one graceful server #7

Closed pwaller closed 10 years ago

pwaller commented 10 years ago

The use of global state means it isn't possible to start multiple servers in one process neatly. You might want to do this to serve http and https from the same process for instance, or two independent pieces of code can't be composed if they both use manners correctly.

Could we instead lose the "implicitly return 200" and say in the instructions that if you want to do asynchronous computation you should use a waitgroup yourself. This would be more idiomatic, I think, rather than hiding what is really happening. It would also obviate the need for global StartRoutine/FinishRoutine methods.

You could also have a GracefulHTTPHandler which requires a .Wait() method, which could be another way to do it (then the user could just embed a waitgroup on their handler type).

lionelbarrow commented 10 years ago

Yea, this sounds good to me. There's a lot about this library that we can improve. I'll tag the current release as 0.1.0 and push a new tag when done.

lionelbarrow commented 10 years ago

Fixed this.