From c4c1708e38a224c27d80984b1383c7a9f0f5e5bd Mon Sep 17 00:00:00 2001 From: Will Browne Date: Wed, 10 Dec 2025 14:07:55 +0000 Subject: [PATCH] Plugins: Sync channel close for app installer readiness (#115078) sync channel close --- apps/plugins/pkg/app/app.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/plugins/pkg/app/app.go b/apps/plugins/pkg/app/app.go index 7d8614f2a3c..4c1ce4cfe0f 100644 --- a/apps/plugins/pkg/app/app.go +++ b/apps/plugins/pkg/app/app.go @@ -3,7 +3,9 @@ package app import ( "context" "fmt" + "sync" + authlib "github.com/grafana/authlib/types" "github.com/grafana/grafana-app-sdk/app" "github.com/grafana/grafana-app-sdk/k8s" appsdkapiserver "github.com/grafana/grafana-app-sdk/k8s/apiserver" @@ -16,7 +18,6 @@ import ( restclient "k8s.io/client-go/rest" "k8s.io/klog/v2" - authlib "github.com/grafana/authlib/types" pluginsappapis "github.com/grafana/grafana/apps/plugins/pkg/apis" pluginsv0alpha1 "github.com/grafana/grafana/apps/plugins/pkg/apis/plugins/v0alpha1" "github.com/grafana/grafana/apps/plugins/pkg/app/meta" @@ -106,12 +107,15 @@ type PluginAppInstaller struct { // restConfig is set during InitializeApp and used by the client factory restConfig *restclient.Config ready chan struct{} + readyOnce sync.Once } func (p *PluginAppInstaller) InitializeApp(restConfig restclient.Config) error { if p.restConfig == nil { p.restConfig = &restConfig - close(p.ready) + p.readyOnce.Do(func() { + close(p.ready) + }) } return p.AppInstaller.InitializeApp(restConfig) }