From 400a632666ad7834ee3d8f90c425d11a4714f562 Mon Sep 17 00:00:00 2001 From: Brian Downs Date: Wed, 17 Mar 2021 14:33:00 -0700 Subject: [PATCH] put etcd bootstrap save call in goroutine and update comment Signed-off-by: Brian Downs --- pkg/cluster/cluster.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index c6e2941b57..a400e356d1 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -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