Navigation Menu

Skip to content

Commit

Permalink
introduce grace reload
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianfei Wang committed Jun 25, 2014
1 parent 9446712 commit 6af659c
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions main.go
Expand Up @@ -12,13 +12,13 @@ import (
"time"

"code.google.com/p/go.net/publicsuffix"
"github.com/facebookgo/grace/gracehttp"
"github.com/golang/groupcache"
"gopkg.in/yaml.v1"
)

type Config struct {
Listen string // API Listen Address
Me string // as ip:port
Peers []string // as a list of ip:port
CacheSize int64 `yaml:"cache_size"` // in MB
MaxItemSize int64 `yaml:"max_item_size"` // in KB
Expand Down Expand Up @@ -145,12 +145,11 @@ func main() {
json.NewEncoder(response).Encode(stats)
})

log.Println("Listening on", config.Listen)
server := &http.Server{
Addr: config.Listen,
Handler: nil,
ReadTimeout: 10 * time.Second,
WriteTimeout: 60 * time.Second,
}
panic(server.ListenAndServe())
gracehttp.Serve(server)
}

0 comments on commit 6af659c

Please sign in to comment.