MM-12849 Moving all non request scoped items to Server struct (#9806)

* Moving goroutine pool

* Auto refactor

* Moving plugins.

* Auto refactor

* Moving fields to server

* Auto refactor

* Removing siteurl duplication.

* Moving reset of app fields

* Auto refactor

* Formatting

* Moving niling of Server to after last use

* Fixing unit tests.
Этот коммит содержится в:
Christopher Speller
2018-11-07 10:20:07 -08:00
коммит произвёл GitHub
родитель 0dcbecac87
Коммит ecade2f1ec
52 изменённых файлов: 388 добавлений и 385 удалений

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

@@ -25,13 +25,13 @@ const (
func (a *App) InitEmailBatching() {
if *a.Config().EmailSettings.EnableEmailBatching {
if a.EmailBatching == nil {
a.EmailBatching = NewEmailBatchingJob(a, *a.Config().EmailSettings.EmailBatchingBufferSize)
if a.Srv.EmailBatching == nil {
a.Srv.EmailBatching = NewEmailBatchingJob(a, *a.Config().EmailSettings.EmailBatchingBufferSize)
}
// note that we don't support changing EmailBatchingBufferSize without restarting the server
a.EmailBatching.Start()
a.Srv.EmailBatching.Start()
}
}
@@ -40,7 +40,7 @@ func (a *App) AddNotificationEmailToBatch(user *model.User, post *model.Post, te
return model.NewAppError("AddNotificationEmailToBatch", "api.email_batching.add_notification_email_to_batch.disabled.app_error", nil, "", http.StatusNotImplemented)
}
if !a.EmailBatching.Add(user, post, team) {
if !a.Srv.EmailBatching.Add(user, post, team) {
mlog.Error("Email batching job's receiving channel was full. Please increase the EmailBatchingBufferSize.")
return model.NewAppError("AddNotificationEmailToBatch", "api.email_batching.add_notification_email_to_batch.channel_full.app_error", nil, "", http.StatusInternalServerError)
}
@@ -188,7 +188,7 @@ func (job *EmailBatchingJob) checkPendingNotifications(now time.Time, handler fu
// send the email notification if it's been long enough
if now.Sub(time.Unix(batchStartTime/1000, 0)) > time.Duration(interval)*time.Second {
job.app.Go(func(userId string, notifications []*batchedNotification) func() {
job.app.Srv.Go(func(userId string, notifications []*batchedNotification) func() {
return func() {
handler(userId, notifications)
}