diff --git a/app/app_iface.go b/app/app_iface.go index 375c945203..066374144a 100644 --- a/app/app_iface.go +++ b/app/app_iface.go @@ -78,7 +78,7 @@ type AppIface interface { ClientConfigWithComputed() map[string]string // ComputeLastAccessiblePostTime updates cache with CreateAt time of the last accessible post as per the cloud plan's limit. // Use GetLastAccessiblePostTime() to access the result. - ComputeLastAccessiblePostTime() *model.AppError + ComputeLastAccessiblePostTime() error // ConvertBotToUser converts a bot to user. ConvertBotToUser(bot *model.Bot, userPatch *model.UserPatch, sysadmin bool) (*model.User, *model.AppError) // ConvertUserToBot converts a user to bot. diff --git a/app/opentracing/opentracing_layer.go b/app/opentracing/opentracing_layer.go index 2ddc75c5cc..7f1e362607 100644 --- a/app/opentracing/opentracing_layer.go +++ b/app/opentracing/opentracing_layer.go @@ -1737,7 +1737,7 @@ func (a *OpenTracingAppLayer) CompleteSwitchWithOAuth(service string, userData i return resultVar0, resultVar1 } -func (a *OpenTracingAppLayer) ComputeLastAccessiblePostTime() *model.AppError { +func (a *OpenTracingAppLayer) ComputeLastAccessiblePostTime() error { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.ComputeLastAccessiblePostTime") diff --git a/app/post.go b/app/post.go index 36e6632ea9..04eba9c3e1 100644 --- a/app/post.go +++ b/app/post.go @@ -1418,7 +1418,7 @@ func (a *App) GetLastAccessiblePostTime() (int64, *model.AppError) { // ComputeLastAccessiblePostTime updates cache with CreateAt time of the last accessible post as per the cloud plan's limit. // Use GetLastAccessiblePostTime() to access the result. -func (a *App) ComputeLastAccessiblePostTime() *model.AppError { +func (a *App) ComputeLastAccessiblePostTime() error { limit, appErr := a.getCloudMessagesHistoryLimit() if appErr != nil { return appErr diff --git a/app/post_test.go b/app/post_test.go index cefa0f5ea9..ff05ad9f68 100644 --- a/app/post_test.go +++ b/app/post_test.go @@ -2877,7 +2877,7 @@ func TestComputeLastAccessiblePostTime(t *testing.T) { mockStore.On("System").Return(&mockSystemStore) err := th.App.ComputeLastAccessiblePostTime() - assert.Nil(t, err) + assert.NoError(t, err) mockSystemStore.AssertCalled(t, "SaveOrUpdate", mock.Anything) } diff --git a/jobs/base_workers.go b/jobs/base_workers.go index b5fbd6166c..4517083415 100644 --- a/jobs/base_workers.go +++ b/jobs/base_workers.go @@ -80,7 +80,7 @@ func (worker *SimpleWorker) DoJob(job *model.Job) { err := worker.execute(job) if err != nil { - mlog.Error("SimpleWorker: Failed to get active user count", mlog.String("worker", worker.name), mlog.String("job_id", job.Id), mlog.Err(err)) + mlog.Error("SimpleWorker: job execution error", mlog.String("worker", worker.name), mlog.String("job_id", job.Id), mlog.Err(err)) worker.setJobError(job, model.NewAppError("DoJob", "app.user.get_total_users_count.app_error", nil, err.Error(), http.StatusInternalServerError)) return } diff --git a/jobs/last_accessible_post/worker.go b/jobs/last_accessible_post/worker.go index 5093f25ab9..2fc09c38b3 100644 --- a/jobs/last_accessible_post/worker.go +++ b/jobs/last_accessible_post/worker.go @@ -13,12 +13,12 @@ const ( ) type AppIface interface { - ComputeLastAccessiblePostTime() *model.AppError + ComputeLastAccessiblePostTime() error } func MakeWorker(jobServer *jobs.JobServer, license *model.License, app AppIface) model.Worker { isEnabled := func(_ *model.Config) bool { - return license != nil && *license.Features.Cloud + return license != nil && license.Features != nil && *license.Features.Cloud } execute := func(_ *model.Job) error { return app.ComputeLastAccessiblePostTime()