repo ensurer: wait at most one minute for repo to become ready

Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
Steve Kriss
2019-04-12 13:12:58 -06:00
parent f879670906
commit 8d61cb0384

View File

@@ -20,6 +20,7 @@ import (
"context"
"fmt"
"sync"
"time"
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
@@ -171,8 +172,10 @@ func (r *repositoryEnsurer) EnsureRepo(ctx context.Context, namespace, volumeNam
}
select {
// TODO it doesn't really make sense to wait for the full pod volume operation timeout
// here - repos should become ready quickly if they don't already exist.
// repositories should become either ready or not ready quickly if they're
// newly created.
case <-time.After(time.Minute):
return nil, errors.New("timed out waiting for restic repository to become ready")
case <-ctx.Done():
return nil, errors.New("timed out waiting for restic repository to become ready")
case res := <-readyChan: