mirror of
https://github.com/mattermost/focalboard.git
synced 2025-04-04 21:14:22 +02:00
don't redundantly send config chg messages to cluster nodes (#3090)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
parent
e01cf226cb
commit
f874c3dce3
@ -381,22 +381,14 @@ func (pa *PluginAdapter) WebSocketMessageHasBeenPosted(webConnID, userID string,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pa *PluginAdapter) sendMessageToAllSkipCluster(payload map[string]interface{}) {
|
// sendMessageToAll will send a websocket message to all clients on all nodes.
|
||||||
|
func (pa *PluginAdapter) sendMessageToAll(event string, payload map[string]interface{}) {
|
||||||
// Empty &mmModel.WebsocketBroadcast will send to all users
|
// Empty &mmModel.WebsocketBroadcast will send to all users
|
||||||
pa.api.PublishWebSocketEvent(websocketActionUpdateConfig, payload, &mmModel.WebsocketBroadcast{})
|
pa.api.PublishWebSocketEvent(event, payload, &mmModel.WebsocketBroadcast{})
|
||||||
}
|
|
||||||
|
|
||||||
func (pa *PluginAdapter) sendMessageToAll(payload map[string]interface{}) {
|
|
||||||
go func() {
|
|
||||||
clusterMessage := &ClusterMessage{Payload: payload}
|
|
||||||
pa.sendMessageToCluster("websocket_message", clusterMessage)
|
|
||||||
}()
|
|
||||||
|
|
||||||
pa.sendMessageToAllSkipCluster(payload)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pa *PluginAdapter) BroadcastConfigChange(pluginConfig model.ClientConfig) {
|
func (pa *PluginAdapter) BroadcastConfigChange(pluginConfig model.ClientConfig) {
|
||||||
pa.sendMessageToAll(utils.StructToMap(pluginConfig))
|
pa.sendMessageToAll(websocketActionUpdateConfig, utils.StructToMap(pluginConfig))
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendUserMessageSkipCluster sends the message to specific users.
|
// sendUserMessageSkipCluster sends the message to specific users.
|
||||||
|
@ -13,7 +13,6 @@ type ClusterMessage struct {
|
|||||||
EnsureUsers []string
|
EnsureUsers []string
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:unparam // the `id` param is to key this function generic and handle more than just websocket messages
|
|
||||||
func (pa *PluginAdapter) sendMessageToCluster(id string, clusterMessage *ClusterMessage) {
|
func (pa *PluginAdapter) sendMessageToCluster(id string, clusterMessage *ClusterMessage) {
|
||||||
b, err := json.Marshal(clusterMessage)
|
b, err := json.Marshal(clusterMessage)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -66,6 +65,7 @@ func (pa *PluginAdapter) HandleClusterEvent(ev mmModel.PluginClusterEvent) {
|
|||||||
"id", ev.Id,
|
"id", ev.Id,
|
||||||
"payload", clusterMessage.Payload,
|
"payload", clusterMessage.Payload,
|
||||||
)
|
)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
pa.sendTeamMessageSkipCluster(websocketActionUpdateBlock, clusterMessage.TeamID, clusterMessage.Payload)
|
pa.sendTeamMessageSkipCluster(websocketActionUpdateBlock, clusterMessage.TeamID, clusterMessage.Payload)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user