mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Plugins: Invalidate plugin context app settings cache post update (#63279)
invalid plugin settings
This commit is contained in:
parent
19d1a46f30
commit
200d2ad249
@ -263,6 +263,8 @@ func (hs *HTTPServer) UpdatePluginSetting(c *contextmodel.ReqContext) response.R
|
|||||||
return response.Error(500, "Failed to update plugin setting", err)
|
return response.Error(500, "Failed to update plugin setting", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hs.PluginContextProvider.InvalidateSettingsCache(c.Req.Context(), pluginID)
|
||||||
|
|
||||||
return response.Success("Plugin settings updated")
|
return response.Success("Plugin settings updated")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ func (p *Provider) pluginContext(ctx context.Context, pluginID string, user *use
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Provider) getCachedPluginSettings(ctx context.Context, pluginID string, user *user.SignedInUser) (*pluginsettings.DTO, error) {
|
func (p *Provider) getCachedPluginSettings(ctx context.Context, pluginID string, user *user.SignedInUser) (*pluginsettings.DTO, error) {
|
||||||
cacheKey := pluginSettingsCachePrefix + pluginID
|
cacheKey := getCacheKey(pluginID)
|
||||||
|
|
||||||
if cached, found := p.cacheService.Get(cacheKey); found {
|
if cached, found := p.cacheService.Get(cacheKey); found {
|
||||||
ps := cached.(*pluginsettings.DTO)
|
ps := cached.(*pluginsettings.DTO)
|
||||||
@ -127,8 +127,16 @@ func (p *Provider) getCachedPluginSettings(ctx context.Context, pluginID string,
|
|||||||
return ps, nil
|
return ps, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *Provider) InvalidateSettingsCache(_ context.Context, pluginID string) {
|
||||||
|
p.cacheService.Delete(getCacheKey(pluginID))
|
||||||
|
}
|
||||||
|
|
||||||
func (p *Provider) decryptSecureJsonDataFn(ctx context.Context) func(ds *datasources.DataSource) (map[string]string, error) {
|
func (p *Provider) decryptSecureJsonDataFn(ctx context.Context) func(ds *datasources.DataSource) (map[string]string, error) {
|
||||||
return func(ds *datasources.DataSource) (map[string]string, error) {
|
return func(ds *datasources.DataSource) (map[string]string, error) {
|
||||||
return p.dataSourceService.DecryptedValues(ctx, ds)
|
return p.dataSourceService.DecryptedValues(ctx, ds)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getCacheKey(pluginID string) string {
|
||||||
|
return pluginSettingsCachePrefix + pluginID
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user