1
0
mirror of https://github.com/rancher/types.git synced 2025-09-01 05:09:10 +00:00

Update vendor

This commit is contained in:
Darren Shepherd
2017-11-28 19:02:51 -07:00
parent 6bef2175e1
commit 3b076deeab
3 changed files with 11 additions and 3 deletions

View File

@@ -98,13 +98,14 @@ func (g *genericController) sync(ctx context.Context) error {
DeleteFunc: g.queueObject,
})
logrus.Infof("Starting %s Controller", g.name)
logrus.Infof("Syncing %s Controller", g.name)
go g.informer.Run(ctx.Done())
if !cache.WaitForCacheSync(ctx.Done(), g.informer.HasSynced) {
return fmt.Errorf("failed to sync controller %s", g.name)
}
logrus.Infof("Syncing %s Controller Done", g.name)
g.synced = true
return nil

View File

@@ -11,8 +11,15 @@ type Starter interface {
Start(ctx context.Context, threadiness int) error
}
func SyncThenSync(ctx context.Context, threadiness int, starters ...Starter) error {
if err := Sync(ctx, starters...); err != nil {
return err
}
return Start(ctx, threadiness, starters...)
}
func Sync(ctx context.Context, starters ...Starter) error {
eg, ctx := errgroup.WithContext(ctx)
eg, _ := errgroup.WithContext(ctx)
for _, starter := range starters {
func(starter Starter) {
eg.Go(func() error {