Skip to content

Commit

Permalink
Makes Producer's Ping method send a NOP command
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarney committed Feb 18, 2015
1 parent 6efbd67 commit 8109ec4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func NewProducer(addr string, config *Config) (*Producer, error) {
}

// Ping causes the Producer to connect to it's configured nsqd (if not already
// connected), returning any error that might occur during the connection.
// connected) and send a `Nop` command, returning any error that might occur.
//
// This method can be used to verify that a newly-created Producer instance is
// configured correctly, rather than relying on the lazy "connect on Publish"
Expand All @@ -96,7 +96,8 @@ func (w *Producer) Ping() error {
return err
}
}
return nil

return w.conn.WriteCommand(Nop())
}

// SetLogger assigns the logger to use as well as a level
Expand Down

0 comments on commit 8109ec4

Please sign in to comment.