element/start.go
2018-09-14 17:00:52 -04:00

24 lines
455 B
Go

package element
import (
"os"
"github.com/sirupsen/logrus"
)
// Start handles cluster events
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)
}
}
}()
if len(a.config.Peers) > 0 {
if _, err := a.members.Join(a.config.Peers); err != nil {
return err
}
}
return nil
}