Move cluster, webhub and store out of Server (#20899)

Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2022-10-06 11:04:21 +03:00
коммит произвёл GitHub
родитель 203df2f537
Коммит 5e69c6b02f
222 изменённых файлов: 9093 добавлений и 7710 удалений

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

@@ -8,7 +8,7 @@ import (
"github.com/gorilla/websocket"
"github.com/mattermost/mattermost-server/v6/app"
"github.com/mattermost/mattermost-server/v6/app/platform"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/shared/mlog"
)
@@ -38,7 +38,7 @@ func connectWebSocket(c *Context, w http.ResponseWriter, r *http.Request) {
// We initialize webconn with all the necessary data.
// If the queues are empty, they are initialized in the constructor.
cfg := &app.WebConnConfig{
cfg := &platform.WebConnConfig{
WebSocket: ws,
Session: *c.AppContext.Session(),
TFunc: c.AppContext.T,
@@ -53,7 +53,7 @@ func connectWebSocket(c *Context, w http.ResponseWriter, r *http.Request) {
cfg.ConnectionID = model.NewId()
// In case of fresh connection id, sequence number is already zero.
} else {
cfg, err = c.App.PopulateWebConnConfig(c.AppContext.Session(), cfg, r.URL.Query().Get(sequenceNumberParam))
cfg, err = c.App.Srv().Platform().PopulateWebConnConfig(c.AppContext.Session(), cfg, r.URL.Query().Get(sequenceNumberParam))
if err != nil {
mlog.Warn("Error while populating webconn config", mlog.String("id", r.URL.Query().Get(connectionIDParam)), mlog.Err(err))
ws.Close()
@@ -61,9 +61,9 @@ func connectWebSocket(c *Context, w http.ResponseWriter, r *http.Request) {
}
}
wc := c.App.NewWebConn(cfg)
wc := c.App.Srv().Platform().NewWebConn(cfg, c.App, c.App.Srv().Channels().GetPluginsEnvironment)
if c.AppContext.Session().UserId != "" {
c.App.HubRegister(wc)
c.App.Srv().Platform().HubRegister(wc)
}
wc.Pump()