[CLD-8131] Convert Subscription History Reporting to a Job (#27800)
* Remove CloudFreeDeprecated feature flag * Fixes for CI pipelines * Remove CloudReverseTrial feature flag and accompanying code (#27676) Co-authored-by: Mattermost Build <build@mattermost.com> * Stashing * Convert subscription history reporting into a daily job * Update comments * Fix pipeline, redundant varaible declaration removed * Add debug logs for start/finish --------- Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
@@ -498,6 +498,7 @@ func NewServer(options ...Option) (*Server, error) {
|
||||
|
||||
func (s *Server) runJobs() {
|
||||
s.runLicenseExpirationCheckJob()
|
||||
|
||||
s.Go(func() {
|
||||
appInstance := New(ServerConnector(s.Channels()))
|
||||
runDNDStatusExpireJob(appInstance)
|
||||
@@ -530,6 +531,9 @@ func (s *Server) runJobs() {
|
||||
s.Go(func() {
|
||||
runConfigCleanupJob(s)
|
||||
})
|
||||
s.Go(func() {
|
||||
runCloudUserCountReportJob(s)
|
||||
})
|
||||
|
||||
if complianceI := s.Channels().Compliance; complianceI != nil {
|
||||
go complianceI.StartComplianceDailyJob()
|
||||
@@ -1234,6 +1238,13 @@ func doSecurity(s *Server) {
|
||||
s.DoSecurityUpdateCheck()
|
||||
}
|
||||
|
||||
// Reports activated user count to the CWS every 24 hours
|
||||
func runCloudUserCountReportJob(s *Server) {
|
||||
model.CreateRecurringTask("Report user count for cloud subscription", func() {
|
||||
s.doReportUserCountForCloudSubscriptionJob()
|
||||
}, time.Hour*24)
|
||||
}
|
||||
|
||||
func doTokenCleanup(s *Server) {
|
||||
expiry := model.GetMillis() - model.MaxTokenExipryTime
|
||||
|
||||
@@ -1334,6 +1345,26 @@ func (s *Server) sendLicenseUpForRenewalEmail(users map[string]*model.User, lice
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) doReportUserCountForCloudSubscriptionJob() {
|
||||
s.LoadLicense()
|
||||
|
||||
if !s.License().IsCloud() {
|
||||
return
|
||||
}
|
||||
|
||||
mlog.Debug("Reporting daily user count for cloud subscription.")
|
||||
|
||||
appInstance := New(ServerConnector(s.Channels()))
|
||||
|
||||
_, err := appInstance.SendSubscriptionHistoryEvent("")
|
||||
|
||||
if err != nil {
|
||||
mlog.Error("an error occurred during daily user count reporting", mlog.Err(err))
|
||||
}
|
||||
|
||||
mlog.Debug("Daily user count reported for cloud subscription.")
|
||||
}
|
||||
|
||||
func (s *Server) doLicenseExpirationCheck() {
|
||||
s.LoadLicense()
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user