mirror of
https://github.com/dragonheim/gagent.git
synced 2025-05-24 13:26:48 -07:00
Minor cleanup and and got the client sending agents again.
This commit is contained in:
parent
42623f63c6
commit
134f33cd6a
7 changed files with 50 additions and 64 deletions
|
@ -28,7 +28,8 @@ func NewConsulClient(addr string) (Client, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &client{consul: c}, nil
|
||||
return &client{c}, nil
|
||||
//return &client{consul: c}, nil
|
||||
}
|
||||
|
||||
// Register a service with consul local agent
|
||||
|
@ -51,10 +52,10 @@ func (c *client) Service(service, tag string) ([]*consul.ServiceEntry, *consul.Q
|
|||
passingOnly := true
|
||||
addrs, meta, err := c.consul.Health().Service(service, tag, passingOnly, nil)
|
||||
if len(addrs) == 0 && err == nil {
|
||||
return nil, fmt.Errorf("service ( %s ) was not found", service)
|
||||
return nil, nil, fmt.Errorf("service ( %s ) was not found", service)
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, nil, err
|
||||
}
|
||||
return addrs, meta, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue