Skip to content

Commit

Permalink
Create pid before connecting to NATs
Browse files Browse the repository at this point in the history
Monit may mark gorouter down because we are still attempting to connect
to NATs.  Create the PID file before we do anything.
  • Loading branch information
fraenkel committed Apr 15, 2014
1 parent a977dfd commit 97d7a90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions router/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ func NewRouter(c *config.Config) *Router {
func (r *Router) Run() {
var err error

util.WritePidFile(r.config.Pidfile)

natsMembers := []yagnats.ConnectionProvider{}

for _, info := range r.config.Nats {
Expand Down Expand Up @@ -146,8 +148,6 @@ func (r *Router) Run() {
log.Fatalf("net.Listen: %s", err)
}

util.WritePidFile(r.config.Pidfile)

log.Infof("Listening on %s", listen.Addr())

server := server.Server{Handler: r.proxy}
Expand Down

0 comments on commit 97d7a90

Please sign in to comment.