Join peers in create

This commit is contained in:
Michael Crosby 2018-09-14 16:46:26 -04:00
parent a1a8f3fa5a
commit d597ca32bd

View file

@ -7,7 +7,7 @@ import (
) )
// Start handles cluster events // Start handles cluster events
func (a *Agent) Start(s chan os.Signal) { func (a *Agent) Start(s chan os.Signal) error {
go func() { go func() {
for range a.peerUpdateChan { for range a.peerUpdateChan {
if err := a.members.UpdateNode(nodeUpdateTimeout); err != nil { if err := a.members.UpdateNode(nodeUpdateTimeout); err != nil {
@ -15,4 +15,10 @@ func (a *Agent) Start(s chan os.Signal) {
} }
} }
}() }()
if len(a.config.Peers) > 0 {
if _, err := a.members.Join(a.config.Peers); err != nil {
return err
}
}
return nil
} }