MM-25516: Changed to byte slice instead of string for cluster messages (#17998)
* MM-25516: Changed to byte slice instead of string for cluster messages https://mattermost.atlassian.net/browse/MM-25116 Testing: Manually tested. Load-tested with Cluster Controller. I looked into changing the serialization method to use msgpack, but the ClusterMessage struct was mainly used for only 3 fields which didn't lead to much of a CPU time improvement, whereas actually led to more allocations using msgpack. Hence, I chose to remain with JSON. ``` name old time/op new time/op delta ClusterMarshal-8 3.51µs ± 1% 3.10µs ± 2% -11.59% (p=0.000 n=9+10) name old alloc/op new alloc/op delta ClusterMarshal-8 776B ± 0% 1000B ± 0% +28.87% (p=0.000 n=10+10) name old allocs/op new allocs/op delta ClusterMarshal-8 12.0 ± 0% 13.0 ± 0% +8.33% (p=0.000 n=10+10) ``` ```release-note Changed the field type of Data in model.ClusterMessage to []byte from string. ``` * Trigger CI ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
23800326a0
Коммит
7be61af24f
@@ -304,11 +304,13 @@ func TestNotifyClusterPluginEvent(t *testing.T) {
|
||||
expectedPluginData := model.PluginEventData{
|
||||
Id: manifest.Id,
|
||||
}
|
||||
|
||||
buf, _ := json.Marshal(expectedPluginData)
|
||||
expectedInstallMessage := &model.ClusterMessage{
|
||||
Event: model.ClusterEventInstallPlugin,
|
||||
SendType: model.ClusterSendReliable,
|
||||
WaitForAllToSend: true,
|
||||
Data: expectedPluginData.ToJson(),
|
||||
Data: buf,
|
||||
}
|
||||
actualMessages := findClusterMessages(model.ClusterEventInstallPlugin, messages)
|
||||
require.Equal(t, []*model.ClusterMessage{expectedInstallMessage}, actualMessages)
|
||||
@@ -354,7 +356,7 @@ func TestNotifyClusterPluginEvent(t *testing.T) {
|
||||
Event: model.ClusterEventRemovePlugin,
|
||||
SendType: model.ClusterSendReliable,
|
||||
WaitForAllToSend: true,
|
||||
Data: expectedPluginData.ToJson(),
|
||||
Data: buf,
|
||||
}
|
||||
actualMessages = findClusterMessages(model.ClusterEventRemovePlugin, messages)
|
||||
require.Equal(t, []*model.ClusterMessage{expectedRemoveMessage}, actualMessages)
|
||||
|
||||
Ссылка в новой задаче
Block a user