From d95cac94d57a5e5cf21449f52bcdf88f01ed0cfe Mon Sep 17 00:00:00 2001 From: Andrei Pohilko Date: Mon, 6 Mar 2023 11:38:33 +0000 Subject: [PATCH] Auto-update repositories each 10 minutes, unless HD_NO_AUTOUPDATE is set --- pkg/dashboard/objects/data.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/dashboard/objects/data.go b/pkg/dashboard/objects/data.go index d21a9fe..b14f95c 100644 --- a/pkg/dashboard/objects/data.go +++ b/pkg/dashboard/objects/data.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "encoding/json" + "os" "sync" "time" @@ -194,13 +195,12 @@ func (d *DataLayer) nsForCtx(ctx string) string { } func (d *DataLayer) PeriodicTasks(ctx context.Context) { - if !d.StatusInfo.ClusterMode { // TODO: maybe have a separate flag for that? - log.Debugf("Not in cluster mode, not starting background tasks") - return - } + // TODO: separate scanning setup for in-cluster? - // auto-update repos - go d.loopUpdateRepos(ctx, 10*time.Minute) // TODO: parameterize interval? + if os.Getenv("HD_NO_AUTOUPDATE") == "" { + // auto-update repos + go d.loopUpdateRepos(ctx, 10*time.Minute) // TODO: parameterize interval? + } // auto-scan }