From ee068726bcd3519bb45ed47c222cc4cd99e2ba5a Mon Sep 17 00:00:00 2001 From: Allan Guwatudde Date: Mon, 27 Mar 2023 10:50:45 +0300 Subject: [PATCH] [MM-51467] - NotifyAdmin job reports an error for unlicensed servers (#22568) * [MM-51467] - Reduce frequency for notify install plugin job * [MM-51467] - NotifyAdmin job reports an error for unlicensed servers * . * fix imports --- server/channels/app/notify_admin.go | 6 +++--- .../channels/jobs/notify_admin/install_plugin_scheduler.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/channels/app/notify_admin.go b/server/channels/app/notify_admin.go index 908134b4b2..87a294c55f 100644 --- a/server/channels/app/notify_admin.go +++ b/server/channels/app/notify_admin.go @@ -48,12 +48,12 @@ func (a *App) SaveAdminNotification(userId string, notifyData *model.NotifyAdmin func (a *App) DoCheckForAdminNotifications(trial bool) *model.AppError { ctx := request.EmptyContext(a.Srv().Log()) + currentSKU := "starter" license := a.Srv().License() - if license == nil { - return model.NewAppError("DoCheckForAdminNotifications", "app.notify_admin.send_notification_post.app_error", nil, "No license found", http.StatusInternalServerError) + if license != nil { + currentSKU = license.SkuShortName } - currentSKU := license.SkuShortName workspaceName := "" return a.SendNotifyAdminPosts(ctx, workspaceName, currentSKU, trial) diff --git a/server/channels/jobs/notify_admin/install_plugin_scheduler.go b/server/channels/jobs/notify_admin/install_plugin_scheduler.go index 36b9818635..91ebdb79c1 100644 --- a/server/channels/jobs/notify_admin/install_plugin_scheduler.go +++ b/server/channels/jobs/notify_admin/install_plugin_scheduler.go @@ -12,7 +12,7 @@ import ( "github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog" ) -const installPluginSchedFreq = 1 * time.Minute +const installPluginSchedFreq = 24 * time.Hour func MakeInstallPluginScheduler(jobServer *jobs.JobServer, license *model.License, jobType string) model.Scheduler { isEnabled := func(cfg *model.Config) bool {