This reverts commit dd73c2af0f.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
01cf4b459f
Коммит
acdfefe456
@@ -17,7 +17,6 @@ func (ps *PlatformService) RegisterClusterHandlers() {
|
||||
ps.clusterIFace.RegisterClusterMessageHandler(model.ClusterEventPublish, ps.ClusterPublishHandler)
|
||||
ps.clusterIFace.RegisterClusterMessageHandler(model.ClusterEventUpdateStatus, ps.ClusterUpdateStatusHandler)
|
||||
ps.clusterIFace.RegisterClusterMessageHandler(model.ClusterEventInvalidateAllCaches, ps.ClusterInvalidateAllCachesHandler)
|
||||
ps.clusterIFace.RegisterClusterMessageHandler(model.ClusterEventLoadLicense, ps.LoadLicenseClusterHandler)
|
||||
ps.clusterIFace.RegisterClusterMessageHandler(model.ClusterEventInvalidateCacheForChannelMembersNotifyProps, ps.clusterInvalidateCacheForChannelMembersNotifyPropHandler)
|
||||
ps.clusterIFace.RegisterClusterMessageHandler(model.ClusterEventInvalidateCacheForChannelByName, ps.clusterInvalidateCacheForChannelByNameHandler)
|
||||
ps.clusterIFace.RegisterClusterMessageHandler(model.ClusterEventInvalidateCacheForUser, ps.clusterInvalidateCacheForUserHandler)
|
||||
@@ -155,27 +154,10 @@ func (ps *PlatformService) InvalidateAllCachesSkipSend() {
|
||||
ps.Store.Webhook().ClearCaches()
|
||||
|
||||
linkCache.Purge()
|
||||
ps.LoadLicense()
|
||||
}
|
||||
|
||||
func (ps *PlatformService) LoadLicenseClusterHandler(_ *model.ClusterMessage) {
|
||||
ps.loadLicense()
|
||||
}
|
||||
|
||||
func (ps *PlatformService) TriggerLoadLicense() {
|
||||
ps.loadLicense()
|
||||
|
||||
if ps.clusterIFace != nil {
|
||||
msg := &model.ClusterMessage{
|
||||
Event: model.ClusterEventLoadLicense,
|
||||
SendType: model.ClusterSendReliable,
|
||||
WaitForAllToSend: true,
|
||||
}
|
||||
|
||||
ps.clusterIFace.SendClusterMessage(msg)
|
||||
}
|
||||
}
|
||||
|
||||
func (ps *PlatformService) InvalidateAllCaches() {
|
||||
func (ps *PlatformService) InvalidateAllCaches() *model.AppError {
|
||||
ps.InvalidateAllCachesSkipSend()
|
||||
|
||||
if ps.clusterIFace != nil {
|
||||
@@ -188,4 +170,6 @@ func (ps *PlatformService) InvalidateAllCaches() {
|
||||
|
||||
ps.clusterIFace.SendClusterMessage(msg)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ func (ps *PlatformService) License() *model.License {
|
||||
return ps.licenseValue.Load()
|
||||
}
|
||||
|
||||
func (ps *PlatformService) loadLicense() {
|
||||
func (ps *PlatformService) LoadLicense() {
|
||||
// ENV var overrides all other sources of license.
|
||||
licenseStr := os.Getenv(LicenseEnv)
|
||||
if licenseStr != "" {
|
||||
@@ -326,6 +326,9 @@ func (ps *PlatformService) RequestTrialLicense(trialRequest *model.TrialLicenseR
|
||||
return err
|
||||
}
|
||||
|
||||
ps.ReloadConfig()
|
||||
ps.InvalidateAllCaches()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,14 @@ import (
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
)
|
||||
|
||||
func TestLoadLicense(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.Service.LoadLicense()
|
||||
require.Nil(t, th.Service.License(), "shouldn't have a valid license")
|
||||
}
|
||||
|
||||
func TestSaveLicense(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -292,7 +292,7 @@ func New(sc ServiceConfig, options ...Option) (*PlatformService, error) {
|
||||
|
||||
// Step 7: Init License
|
||||
if model.BuildEnterpriseReady == "true" {
|
||||
ps.TriggerLoadLicense()
|
||||
ps.LoadLicense()
|
||||
}
|
||||
|
||||
// Step 8: Init Metrics Server depends on step 6 (store) and 7 (license)
|
||||
@@ -353,7 +353,9 @@ func (ps *PlatformService) Start() error {
|
||||
message := model.NewWebSocketEvent(model.WebsocketEventConfigChanged, "", "", "", nil, "")
|
||||
|
||||
message.Add("config", ps.ClientConfigWithComputed())
|
||||
ps.Publish(message)
|
||||
ps.Go(func() {
|
||||
ps.Publish(message)
|
||||
})
|
||||
|
||||
if err := ps.ReconfigureLogger(); err != nil {
|
||||
mlog.Error("Error re-configuring logging after config change", mlog.Err(err))
|
||||
@@ -366,7 +368,9 @@ func (ps *PlatformService) Start() error {
|
||||
|
||||
message := model.NewWebSocketEvent(model.WebsocketEventLicenseChanged, "", "", "", nil, "")
|
||||
message.Add("license", ps.GetSanitizedClientLicense())
|
||||
ps.Publish(message)
|
||||
ps.Go(func() {
|
||||
ps.Publish(message)
|
||||
})
|
||||
|
||||
})
|
||||
return nil
|
||||
|
||||
Ссылка в новой задаче
Block a user