Removing some unneded FakeApp instance (#14139)

Этот коммит содержится в:
Jesús Espino
2020-03-27 14:52:57 +01:00
коммит произвёл GitHub
родитель cfe65a33a5
Коммит 9a531fa0fb
8 изменённых файлов: 85 добавлений и 92 удалений

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

@@ -33,6 +33,7 @@ import (
"github.com/mattermost/mattermost-server/v5/plugin"
"github.com/mattermost/mattermost-server/v5/services/cache"
"github.com/mattermost/mattermost-server/v5/services/cache/lru"
"github.com/mattermost/mattermost-server/v5/services/filesstore"
"github.com/mattermost/mattermost-server/v5/services/httpservice"
"github.com/mattermost/mattermost-server/v5/services/imageproxy"
"github.com/mattermost/mattermost-server/v5/services/searchengine"
@@ -202,7 +203,7 @@ func NewServer(options ...Option) (*Server, error) {
s.NotificationsLog.ChangeLevels(utils.MloggerConfigFromLoggerConfig(notificationLogSettings, utils.GetNotificationsLogFileLocation))
})
s.HTTPService = httpservice.MakeHTTPService(s.FakeApp())
s.HTTPService = httpservice.MakeHTTPService(s)
s.ImageProxy = imageproxy.MakeImageProxy(s, s.HTTPService, s.Log)
@@ -918,3 +919,36 @@ func (s *Server) SetHub(index int, hub *Hub) error {
s.hubs[index] = hub
return nil
}
func (s *Server) FileBackend() (filesstore.FileBackend, *model.AppError) {
license := s.License()
return filesstore.NewFileBackend(&s.Config().FileSettings, license != nil && *license.Features.Compliance)
}
func (s *Server) TotalWebsocketConnections() int {
count := int64(0)
for _, hub := range s.GetHubs() {
count = count + atomic.LoadInt64(&hub.connectionCount)
}
return int(count)
}
func (s *Server) ensureDiagnosticId() {
if s.diagnosticId != "" {
return
}
props, err := s.Store.System().Get()
if err != nil {
return
}
id := props[model.SYSTEM_DIAGNOSTIC_ID]
if len(id) == 0 {
id = model.NewId()
systemID := &model.System{Name: model.SYSTEM_DIAGNOSTIC_ID, Value: id}
s.Store.System().Save(systemID)
}
s.diagnosticId = id
}