Merge pull request #3091 from briandowns/put_etcd_save_in_goroutine

put etcd bootstrap save call in goroutine and update comment
pull/3106/head
Brian Downs 2021-03-17 15:51:17 -07:00 committed by GitHub
commit 9bae285bfd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 6 deletions

View File

@ -96,13 +96,18 @@ func (c *Cluster) Start(ctx context.Context) (<-chan struct{}, error) {
return nil, err
}
// at this point, if etcd is in use, it's up, ready,
// and bootstrapping is complete so save the bootstrap
// data
// at this point, if etcd is in use, it's bootstrapping is complete
// so save the bootstrap data. We will need for etcd to be up. If
// the save call returns an error, we panic since subsequent etcd
// snapshots will be empty.
if c.managedDB != nil {
if err := c.save(ctx); err != nil {
return nil, err
}
go func() {
for range ready {
if err := c.save(ctx); err != nil {
panic(err)
}
}
}()
}
return ready, nil