element/start.go

25 lines
455 B
Go
Raw Normal View History

package element
import (
"os"
"github.com/sirupsen/logrus"
)
// Start handles cluster events
2018-09-14 20:46:26 +00:00
func (a *Agent) Start(s chan os.Signal) error {
go func() {
for range a.peerUpdateChan {
if err := a.members.UpdateNode(nodeUpdateTimeout); err != nil {
logrus.Errorf("error updating node metadata: %s", err)
}
}
}()
2018-09-14 20:46:26 +00:00
if len(a.config.Peers) > 0 {
if _, err := a.members.Join(a.config.Peers); err != nil {
return err
}
}
return nil
}