Live: Update Centrifuge to the latest version (#66637)

This commit is contained in:
Alexander Emelin
2023-04-19 07:47:15 +03:00
committed by GitHub
parent 97a0527b44
commit 842ce14429
3 changed files with 30 additions and 39 deletions

View File

@@ -106,6 +106,11 @@ func ProvideService(plugCtxProvider *plugincontext.Provider, cfg *setting.Cfg, r
LogHandler: handleLog,
LogLevel: centrifuge.LogLevelError,
MetricsNamespace: "grafana_live",
// Use reasonably large expiration interval for stream meta key,
// much bigger than maximum HistoryLifetime value in Node config.
// This way stream meta data will expire, in some cases you may want
// to prevent its expiration setting this to zero value.
HistoryMetaTTL: 7 * 24 * time.Hour,
})
if err != nil {
return nil, err
@@ -131,14 +136,6 @@ func ProvideService(plugCtxProvider *plugincontext.Provider, cfg *setting.Cfg, r
broker, err := centrifuge.NewRedisBroker(node, centrifuge.RedisBrokerConfig{
Prefix: "gf_live",
// Use reasonably large expiration interval for stream meta key,
// much bigger than maximum HistoryLifetime value in Node config.
// This way stream meta data will expire, in some cases you may want
// to prevent its expiration setting this to zero value.
HistoryMetaTTL: 7 * 24 * time.Hour,
// And configure a couple of shards to use.
Shards: redisShards,
})
if err != nil {
@@ -283,7 +280,6 @@ func ProvideService(plugCtxProvider *plugincontext.Provider, cfg *setting.Cfg, r
// Use a pure websocket transport.
wsHandler := centrifuge.NewWebsocketHandler(node, centrifuge.WebsocketConfig{
ProtocolVersion: centrifuge.ProtocolVersion2,
ReadBufferSize: 1024,
WriteBufferSize: 1024,
CheckOrigin: checkOrigin,