Skip to content

Commit

Permalink
engine: hide "cache is not started" errors from uiresource/uisession (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
landism committed Jun 22, 2021
1 parent 25b7097 commit 925fc7b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/engine/uiresource/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package uiresource
import (
"context"
"fmt"
"strings"

apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/cache"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"

"github.com/tilt-dev/tilt/internal/controllers/apicmp"
Expand Down Expand Up @@ -52,7 +52,7 @@ func (s *Subscriber) OnChange(ctx context.Context, st store.RStore, summary stor
if err != nil {
// If the cache hasn't started yet, that's OK.
// We'll get it on the next OnChange()
if strings.Contains(err.Error(), "cache not started") {
if _, ok := err.(*cache.ErrCacheNotStarted); ok {
return nil
}

Expand Down
7 changes: 7 additions & 0 deletions internal/engine/uisession/subscriber.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
"sigs.k8s.io/controller-runtime/pkg/cache"
ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"

"github.com/tilt-dev/tilt/internal/controllers/apicmp"
Expand Down Expand Up @@ -42,6 +43,12 @@ func (s *Subscriber) OnChange(ctx context.Context, st store.RStore, summary stor
}
return nil
} else if err != nil {
// If the cache hasn't started yet, that's OK.
// We'll get it on the next OnChange()
if _, ok := err.(*cache.ErrCacheNotStarted); ok {
return nil
}

logger.Get(ctx).Infof("fetching uisession: %v", err)
return nil
}
Expand Down

0 comments on commit 925fc7b

Please sign in to comment.