From 02cf83db95dff50cbfa90f5c8b3b3345469968ab Mon Sep 17 00:00:00 2001 From: Ahmad Karimi Date: Tue, 15 Aug 2023 20:03:53 +0330 Subject: [PATCH] fix lint issues Signed-off-by: Ahmad Karimi --- cmd/contour/serve.go | 17 ++++++++--------- internal/contour/handler.go | 1 - 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/cmd/contour/serve.go b/cmd/contour/serve.go index 09f36b74c29..58af5d45b1d 100644 --- a/cmd/contour/serve.go +++ b/cmd/contour/serve.go @@ -836,13 +836,12 @@ func (s *Server) setupDebugService(debugConfig contour_api_v1alpha1.DebugConfig, } type xdsServer struct { - log logrus.FieldLogger - registry *prometheus.Registry - config contour_api_v1alpha1.XDSServerConfig - snapshotHandler *xdscache.SnapshotHandler - resources []xdscache.ResourceCache - handlerCacheSyncs []cache.InformerSynced - initialDagBuilt func() bool + log logrus.FieldLogger + registry *prometheus.Registry + config contour_api_v1alpha1.XDSServerConfig + snapshotHandler *xdscache.SnapshotHandler + resources []xdscache.ResourceCache + initialDagBuilt func() bool } func (x *xdsServer) NeedLeaderElection() bool { @@ -853,9 +852,9 @@ func (x *xdsServer) Start(ctx context.Context) error { log := x.log.WithField("context", "xds") log.Printf("waiting for the initial dag to be built") - if err := wait.PollImmediateUntil(initialDagBuildPollPeriod, func() (bool, error) { + if err := wait.PollUntilContextCancel(ctx, initialDagBuildPollPeriod, true, func(ctx context.Context) (done bool, err error) { return x.initialDagBuilt(), nil - }, ctx.Done()); err != nil { + }); err != nil { return fmt.Errorf("failed to wait for initial dag build, %w", err) } log.Printf("the initial dag is built") diff --git a/internal/contour/handler.go b/internal/contour/handler.go index 815f401aa8b..76db0a49045 100644 --- a/internal/contour/handler.go +++ b/internal/contour/handler.go @@ -93,7 +93,6 @@ type opDelete struct { func (e *EventHandler) OnAdd(obj any, isInInitialList bool) { if isInInitialList { - time.Sleep(time.Second * 3) e.syncTracker.Start() } e.update <- opAdd{obj: obj, isInInitialList: isInInitialList}