Adds support for clustered websocket messages for products (#21737)
* Adds support for clustered websocket messages for products * Update app/cluster_handlers.go Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com> Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f390d88d0c
Коммит
e031b16b16
@@ -37,6 +37,10 @@ func (s *Server) clusterPluginEventHandler(msg *model.ClusterMessage) {
|
||||
return
|
||||
}
|
||||
pluginID := msg.Props["PluginID"]
|
||||
// if the plugin key is empty, the message might be coming from a product.
|
||||
if pluginID == "" {
|
||||
pluginID = msg.Props["ProductID"]
|
||||
}
|
||||
eventID := msg.Props["EventID"]
|
||||
if pluginID == "" || eventID == "" {
|
||||
mlog.Warn("Invalid ClusterMessage.Props values for plugin event",
|
||||
|
||||
@@ -499,6 +499,12 @@ func (env *Environment) HooksForPlugin(id string) (Hooks, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if p, ok := env.registeredProducts.Load(id); ok {
|
||||
rp := p.(*registeredProduct)
|
||||
|
||||
return rp.adapter, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("plugin not found: %v", id)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user