Rendering: periodically refresh remote plugin version (#45505)

* #44449: refresh image renderer version on a schedule

* #44449: simplify
This commit is contained in:
Artur Wierzbicki
2022-02-18 20:25:01 +04:00
committed by GitHub
parent 78c35e6000
commit 7643ae6c5e
2 changed files with 39 additions and 4 deletions
+13 -2
View File
@@ -120,8 +120,19 @@ func (rs *RenderingService) Run(ctx context.Context) error {
})
rs.renderAction = rs.renderViaHTTP
rs.renderCSVAction = rs.renderCSVViaHTTP
<-ctx.Done()
return nil
refreshTicker := time.NewTicker(remoteVersionRefreshInterval)
for {
select {
case <-refreshTicker.C:
go rs.refreshRemotePluginVersion()
case <-ctx.Done():
rs.log.Debug("Grafana is shutting down - stopping image-renderer version refresh")
refreshTicker.Stop()
return nil
}
}
}
if rs.pluginAvailable() {