From a14ae53347a33b151b2393e6094fd02770b006c3 Mon Sep 17 00:00:00 2001 From: Alexander Emelin Date: Wed, 12 May 2021 22:17:31 +0300 Subject: [PATCH] UseRunStream is a default behaviour (#34021) --- go.mod | 2 +- go.sum | 7 ++++--- pkg/services/live/features/plugin.go | 22 ++++++++++------------ pkg/tsdb/testdatasource/stream_handler.go | 5 ++--- 4 files changed, 17 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index c9230d20803..59ff101b4c6 100644 --- a/go.mod +++ b/go.mod @@ -50,7 +50,7 @@ require ( github.com/grafana/grafana-aws-sdk v0.4.0 github.com/grafana/grafana-live-sdk v0.0.5 github.com/grafana/grafana-plugin-model v0.0.0-20190930120109-1fc953a61fb4 - github.com/grafana/grafana-plugin-sdk-go v0.96.0 + github.com/grafana/grafana-plugin-sdk-go v0.97.0 github.com/grafana/loki v1.6.2-0.20210510132741-f408e05ad426 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/hashicorp/go-hclog v0.16.0 diff --git a/go.sum b/go.sum index 5a62d6dfa17..dcd0e7b26ba 100644 --- a/go.sum +++ b/go.sum @@ -915,8 +915,8 @@ github.com/grafana/grafana-plugin-model v0.0.0-20190930120109-1fc953a61fb4 h1:SP github.com/grafana/grafana-plugin-model v0.0.0-20190930120109-1fc953a61fb4/go.mod h1:nc0XxBzjeGcrMltCDw269LoWF9S8ibhgxolCdA1R8To= github.com/grafana/grafana-plugin-sdk-go v0.79.0/go.mod h1:NvxLzGkVhnoBKwzkst6CFfpMFKwAdIUZ1q8ssuLeF60= github.com/grafana/grafana-plugin-sdk-go v0.91.0/go.mod h1:Ot3k7nY7P6DXmUsDgKvNB7oG1v7PRyTdmnYVoS554bU= -github.com/grafana/grafana-plugin-sdk-go v0.96.0 h1:buENZtf+WB/X7hwcJKsnL5x7sVJZfXqONwnSuGlcS2g= -github.com/grafana/grafana-plugin-sdk-go v0.96.0/go.mod h1:3VXz4nCv6wH5SfgB3mlW39s+c+LetqSCjFj7xxPC5+M= +github.com/grafana/grafana-plugin-sdk-go v0.97.0 h1:V9307Grs2QLvzcldC4hwe3Q1jh6vEMIwONq+l0iy+mk= +github.com/grafana/grafana-plugin-sdk-go v0.97.0/go.mod h1:kgJSx8txPM+3lxLdSp+E9mdnB0xbXkM7VWr7FSHJY0k= github.com/grafana/loki v1.6.2-0.20210510132741-f408e05ad426 h1:fVUMdXAjiHsx71Twl/oie1OLDH+dxL7+mBdQK/H2Wgs= github.com/grafana/loki v1.6.2-0.20210510132741-f408e05ad426/go.mod h1:IfQ9BWq2sVAk3iKB4Pahz6QNTs5D4WpfJj/AY8xzmNw= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -1327,8 +1327,9 @@ github.com/mitchellh/mapstructure v1.4.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RR github.com/mitchellh/mapstructure v1.4.1 h1:CpVNEelQCZBooIPDn+AR3NpivK/TIKU8bDxdASFVQag= github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= -github.com/mitchellh/reflectwalk v1.0.1 h1:FVzMWA5RllMAKIdUSC8mdWo3XtwoecrH79BY70sEEpE= github.com/mitchellh/reflectwalk v1.0.1/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mjibson/esc v0.2.0/go.mod h1:9Hw9gxxfHulMF5OJKCyhYD7PzlSdhzXyaGEBRPH1OPs= github.com/mna/redisc v1.1.7 h1:FdmtJsfTjoIjNXiQf4ozgNjuE+zxWH+fJSe+I/dD4vc= github.com/mna/redisc v1.1.7/go.mod h1:GXeOb7zyYKiT+K8MKdIiJvuv7MfhDoQGcuzfiJQmqQI= diff --git a/pkg/services/live/features/plugin.go b/pkg/services/live/features/plugin.go index 29a75d77689..5206c73ded9 100644 --- a/pkg/services/live/features/plugin.go +++ b/pkg/services/live/features/plugin.go @@ -81,21 +81,19 @@ func (r *PluginPathRunner) OnSubscribe(ctx context.Context, user *models.SignedI return models.SubscribeReply{}, resp.Status, nil } - if resp.UseRunStream { - submitResult, err := r.runStreamManager.SubmitStream(ctx, user.OrgId, e.Channel, r.path, pCtx, r.handler) - if err != nil { - logger.Error("Error submitting stream to manager", "error", err, "path", r.path) - return models.SubscribeReply{}, 0, centrifuge.ErrorInternal - } - if submitResult.StreamExists { - logger.Debug("Skip running new stream (already exists)", "path", r.path) - } else { - logger.Debug("Running a new keepalive stream", "path", r.path) - } + submitResult, err := r.runStreamManager.SubmitStream(ctx, user.OrgId, e.Channel, r.path, pCtx, r.handler) + if err != nil { + logger.Error("Error submitting stream to manager", "error", err, "path", r.path) + return models.SubscribeReply{}, 0, centrifuge.ErrorInternal + } + if submitResult.StreamExists { + logger.Debug("Skip running new stream (already exists)", "path", r.path) + } else { + logger.Debug("Running a new keepalive stream", "path", r.path) } reply := models.SubscribeReply{ - Presence: resp.UseRunStream, // only enable presence for streams with UseRunStream on at the moment. + Presence: true, Data: resp.Data, } return reply, backend.SubscribeStreamStatusOK, nil diff --git a/pkg/tsdb/testdatasource/stream_handler.go b/pkg/tsdb/testdatasource/stream_handler.go index e208b56c9d4..ac42c1b604d 100644 --- a/pkg/tsdb/testdatasource/stream_handler.go +++ b/pkg/tsdb/testdatasource/stream_handler.go @@ -38,9 +38,8 @@ func (p *testStreamHandler) SubscribeStream(_ context.Context, req *backend.Subs } p.logger.Debug("Allowing access to stream", "path", req.Path, "user", req.PluginContext.User) return &backend.SubscribeStreamResponse{ - Status: backend.SubscribeStreamStatusOK, - Data: schema, - UseRunStream: true, + Status: backend.SubscribeStreamStatusOK, + Data: schema, }, nil }