Revert "MM-53879: Fix recursive loading of license (#24200)" (#24498)

This reverts commit dd73c2af0f.
Этот коммит содержится в:
Agniva De Sarker
2023-09-07 20:58:20 +05:30
коммит произвёл GitHub
родитель 01cf4b459f
Коммит acdfefe456
15 изменённых файлов: 165 добавлений и 31 удалений

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

@@ -209,6 +209,7 @@ func NewServer(options ...Option) (*Server, error) {
// Depends on step 1 (s.Platform must be non-nil)
s.initEnterprise()
// Needed to run before loading license.
s.userService, err = users.New(users.ServiceConfig{
UserStore: s.Store().User(),
SessionStore: s.Store().Session(),
@@ -222,6 +223,11 @@ func NewServer(options ...Option) (*Server, error) {
return nil, errors.Wrapf(err, "unable to create users service")
}
if model.BuildEnterpriseReady == "true" {
// Dependent on user service
s.LoadLicense()
}
s.licenseWrapper = &licenseWrapper{
srv: s,
}
@@ -1378,6 +1384,8 @@ func (s *Server) sendLicenseUpForRenewalEmail(users map[string]*model.User, lice
}
func (s *Server) doLicenseExpirationCheck() {
s.LoadLicense()
// This takes care of a rare edge case reported here https://mattermost.atlassian.net/browse/MM-40962
// To reproduce that case locally, attach a license to a server that was started with enterprise enabled
// Then restart using BUILD_ENTERPRISE=false make restart-server to enter Team Edition
@@ -1387,6 +1395,7 @@ func (s *Server) doLicenseExpirationCheck() {
}
license := s.License()
if license == nil {
mlog.Debug("License cannot be found.")
return