Live: stream resubmit on ds change, fix old ds settings in RunStream (#34130)
This commit is contained in:
@@ -17,6 +17,7 @@ func ModelToInstanceSettings(ds *models.DataSource) (*backend.DataSourceInstance
|
||||
ID: ds.Id,
|
||||
Name: ds.Name,
|
||||
URL: ds.Url,
|
||||
UID: ds.Uid,
|
||||
Database: ds.Database,
|
||||
User: ds.User,
|
||||
BasicAuthEnabled: ds.BasicAuth,
|
||||
|
||||
@@ -3,6 +3,7 @@ package grpcplugin
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
@@ -216,7 +217,7 @@ func (c *clientV2) RunStream(ctx context.Context, req *backend.RunStreamRequest,
|
||||
if errors.Is(err, io.EOF) {
|
||||
return nil
|
||||
}
|
||||
return errutil.Wrap("failed to receive call resource response", err)
|
||||
return fmt.Errorf("error running stream: %w", err)
|
||||
}
|
||||
if err := sender.Send(backend.FromProto().StreamPacket(protoResp)); err != nil {
|
||||
return err
|
||||
|
||||
@@ -42,7 +42,7 @@ func (p *Provider) Init() error {
|
||||
// Get allows getting plugin context by its id. If datasourceUID is not empty string
|
||||
// then PluginContext.DataSourceInstanceSettings will be resolved and appended to
|
||||
// returned context.
|
||||
func (p *Provider) Get(pluginID string, datasourceUID string, user *models.SignedInUser) (backend.PluginContext, bool, error) {
|
||||
func (p *Provider) Get(pluginID string, datasourceUID string, user *models.SignedInUser, skipCache bool) (backend.PluginContext, bool, error) {
|
||||
pc := backend.PluginContext{}
|
||||
plugin := p.PluginManager.GetPlugin(pluginID)
|
||||
if plugin == nil {
|
||||
@@ -81,7 +81,7 @@ func (p *Provider) Get(pluginID string, datasourceUID string, user *models.Signe
|
||||
}
|
||||
|
||||
if datasourceUID != "" {
|
||||
ds, err := p.DatasourceCache.GetDatasourceByUID(datasourceUID, user, false)
|
||||
ds, err := p.DatasourceCache.GetDatasourceByUID(datasourceUID, user, skipCache)
|
||||
if err != nil {
|
||||
return pc, false, errutil.Wrap("Failed to get datasource", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user