discovery: add fast path

This commit is contained in:
Xiang Li 2014-09-21 22:34:39 -07:00
parent 2b623cf0fa
commit b8eb21c027

View File

@ -29,6 +29,13 @@ type discovery struct {
}
func (d *discovery) discover() (*etcdhttp.Peers, error) {
// fast path: if the cluster is full, returns the error
// do not need to register itself to the cluster in this
// case.
if _, _, err := d.checkCluster(); err != nil {
return nil, err
}
if err := d.createSelf(); err != nil {
return nil, err
}