[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 удалений

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

@@ -46,7 +46,6 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
openChan := a.Srv.Store.Channel().AnalyticsTypeCount(teamId, model.CHANNEL_OPEN)
privateChan := a.Srv.Store.Channel().AnalyticsTypeCount(teamId, model.CHANNEL_PRIVATE)
teamChan := a.Srv.Store.Team().AnalyticsTeamCount()
var userChan store.StoreChannel
var userInactiveChan store.StoreChannel
@@ -65,6 +64,12 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
dailyActiveChan := a.Srv.Store.User().AnalyticsActiveCount(DAY_MILLISECONDS)
monthlyActiveChan := a.Srv.Store.User().AnalyticsActiveCount(MONTH_MILLISECONDS)
teamCountChan := make(chan store.StoreResult, 1)
go func() {
teamCount, err := a.Srv.Store.Team().AnalyticsTeamCount()
teamCountChan <- store.StoreResult{Data: teamCount, Err: err}
close(teamCountChan)
}()
r := <-openChan
if r.Err != nil {
@@ -108,7 +113,7 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
rows[10].Value = float64(r.Data.(int64))
}
r = <-teamChan
r = <-teamCountChan
if r.Err != nil {
return nil, r.Err
}