From a8d12869e7cb546f82a16dea44e9825dce3c5566 Mon Sep 17 00:00:00 2001 From: michaeljguarino Date: Fri, 29 Sep 2023 17:04:35 -0400 Subject: [PATCH] implement cache wipe in control loop --- pkg/agent/agent.go | 1 + pkg/sync/engine.go | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/pkg/agent/agent.go b/pkg/agent/agent.go index 7a602a34..0d656d6b 100644 --- a/pkg/agent/agent.go +++ b/pkg/agent/agent.go @@ -87,6 +87,7 @@ func (agent *Agent) Run() { for { log.Info("fetching services for cluster") + agent.engine.WipeCache() svcs, err := agent.consoleClient.GetServices() if err != nil { log.Error(err, "failed to fetch service list from deployments service") diff --git a/pkg/sync/engine.go b/pkg/sync/engine.go index 7b70fb21..3f126179 100644 --- a/pkg/sync/engine.go +++ b/pkg/sync/engine.go @@ -46,6 +46,11 @@ func (engine *Engine) RegisterHandlers() { }) } +func (engine *Engine) WipeCache() { + engine.svcCache.Wipe() + engine.manifestCache.Wipe() +} + func isRoot(r *cache.Resource) bool { return svcId(r) != nil && len(r.OwnerRefs) == 0 }