[MM-16173] Migrate Team.AnalyticsTeamCount to Sync by default #11126 (#11132)

* [MM-16173] Migrate Team.AnalyticsTeamCount to Sync by default #11126
+ Modified team_store.AnalyticsTeamCount to return (int64, *model.AppError) instead of store.StoreChannel.
+ Updated the mock store to reflect new return value.
+ Updated referencing code to handle new sync return value.

* Fix shadowing of the err

* Fix the empty line between related code

* Fix team count call to be an explicit async.

* Added error logging to diagnostics.go

* Fix gofmt in file
Этот коммит содержится в:
Kyle Reczek
2019-06-14 08:01:24 -06:00
коммит произвёл Christopher Poile
родитель e101e1c020
Коммит b61ded0ae4
9 изменённых файлов: 44 добавлений и 34 удалений

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

@@ -460,15 +460,14 @@ func (s SqlTeamStore) PermanentDelete(teamId string) store.StoreChannel {
})
}
func (s SqlTeamStore) AnalyticsTeamCount() store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
c, err := s.GetReplica().SelectInt("SELECT COUNT(*) FROM Teams WHERE DeleteAt = 0", map[string]interface{}{})
if err != nil {
result.Err = model.NewAppError("SqlTeamStore.AnalyticsTeamCount", "store.sql_team.analytics_team_count.app_error", nil, err.Error(), http.StatusInternalServerError)
return
}
result.Data = c
})
func (s SqlTeamStore) AnalyticsTeamCount() (int64, *model.AppError) {
c, err := s.GetReplica().SelectInt("SELECT COUNT(*) FROM Teams WHERE DeleteAt = 0", map[string]interface{}{})
if err != nil {
return int64(0), model.NewAppError("SqlTeamStore.AnalyticsTeamCount", "store.sql_team.analytics_team_count.app_error", nil, err.Error(), http.StatusInternalServerError)
}
return c, nil
}
func (s SqlTeamStore) getTeamMembersWithSchemeSelectQuery() sq.SelectBuilder {