MM-62378: Initialize status and session cache before loading license (#29686)

* MM-62378: Initialize status and session cache before loading license

ps.LoadLicense could end up calling InvalidateAllCaches. Therefore,
we need to intialize those caches before calling LoadLicense
to prevent a panic from happening.

While here, we also remove some unused code.

https://mattermost.atlassian.net/browse/MM-62378
```release-note
NONE
```

* fix lint errors

```release-note
NONE
```

* fix test

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2025-01-03 10:25:35 +05:30
коммит произвёл GitHub
родитель b61580f87f
Коммит 148dff2c24
3 изменённых файлов: 69 добавлений и 48 удалений

Просмотреть файл

@@ -6,7 +6,6 @@ package platform
import (
"bytes"
"encoding/json"
"fmt"
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
@@ -31,19 +30,6 @@ func (ps *PlatformService) RegisterClusterMessageHandler(ev model.ClusterEvent,
ps.additionalClusterHandlers[ev] = h
}
// ClusterHandlersPreCheck checks whether the platform service is ready to handle cluster messages.
func (ps *PlatformService) ClusterHandlersPreCheck() error {
if ps.Store == nil {
return fmt.Errorf("could not find store")
}
if ps.statusCache == nil {
return fmt.Errorf("could not find status cache")
}
return nil
}
func (ps *PlatformService) ClusterPublishHandler(msg *model.ClusterMessage) {
event, err := model.WebSocketEventFromJSON(bytes.NewReader(msg.Data))
if err != nil {