коммит произвёл
GitHub
родитель
5ddf8d4099
Коммит
48f0b7fd76
@@ -46,13 +46,13 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
||||
openChan := make(chan store.StoreResult, 1)
|
||||
privateChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
count, err := a.Srv().Store.Channel().AnalyticsTypeCount(teamId, model.CHANNEL_OPEN)
|
||||
openChan <- store.StoreResult{Data: count, Err: err}
|
||||
count, err2 := a.Srv().Store.Channel().AnalyticsTypeCount(teamId, model.CHANNEL_OPEN)
|
||||
openChan <- store.StoreResult{Data: count, Err: err2}
|
||||
close(openChan)
|
||||
}()
|
||||
go func() {
|
||||
count, err := a.Srv().Store.Channel().AnalyticsTypeCount(teamId, model.CHANNEL_PRIVATE)
|
||||
privateChan <- store.StoreResult{Data: count, Err: err}
|
||||
count, err2 := a.Srv().Store.Channel().AnalyticsTypeCount(teamId, model.CHANNEL_PRIVATE)
|
||||
privateChan <- store.StoreResult{Data: count, Err: err2}
|
||||
close(privateChan)
|
||||
}()
|
||||
|
||||
@@ -61,15 +61,15 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
||||
if teamId == "" {
|
||||
userInactiveChan = make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
count, err := a.Srv().Store.User().AnalyticsGetInactiveUsersCount()
|
||||
userInactiveChan <- store.StoreResult{Data: count, Err: err}
|
||||
count, err2 := a.Srv().Store.User().AnalyticsGetInactiveUsersCount()
|
||||
userInactiveChan <- store.StoreResult{Data: count, Err: err2}
|
||||
close(userInactiveChan)
|
||||
}()
|
||||
} else {
|
||||
userChan = make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
count, err := a.Srv().Store.User().Count(model.UserCountOptions{TeamId: teamId})
|
||||
userChan <- store.StoreResult{Data: count, Err: err}
|
||||
count, err2 := a.Srv().Store.User().Count(model.UserCountOptions{TeamId: teamId})
|
||||
userChan <- store.StoreResult{Data: count, Err: err2}
|
||||
close(userChan)
|
||||
}()
|
||||
}
|
||||
@@ -78,30 +78,30 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
||||
if !skipIntensiveQueries {
|
||||
postChan = make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
count, err := a.Srv().Store.Post().AnalyticsPostCount(teamId, false, false)
|
||||
postChan <- store.StoreResult{Data: count, Err: err}
|
||||
count, err2 := a.Srv().Store.Post().AnalyticsPostCount(teamId, false, false)
|
||||
postChan <- store.StoreResult{Data: count, Err: err2}
|
||||
close(postChan)
|
||||
}()
|
||||
}
|
||||
|
||||
teamCountChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
teamCount, err := a.Srv().Store.Team().AnalyticsTeamCount(false)
|
||||
teamCountChan <- store.StoreResult{Data: teamCount, Err: err}
|
||||
teamCount, err2 := a.Srv().Store.Team().AnalyticsTeamCount(false)
|
||||
teamCountChan <- store.StoreResult{Data: teamCount, Err: err2}
|
||||
close(teamCountChan)
|
||||
}()
|
||||
|
||||
dailyActiveChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
dailyActive, err := a.Srv().Store.User().AnalyticsActiveCount(DAY_MILLISECONDS, model.UserCountOptions{IncludeBotAccounts: false, IncludeDeleted: false})
|
||||
dailyActiveChan <- store.StoreResult{Data: dailyActive, Err: err}
|
||||
dailyActive, err2 := a.Srv().Store.User().AnalyticsActiveCount(DAY_MILLISECONDS, model.UserCountOptions{IncludeBotAccounts: false, IncludeDeleted: false})
|
||||
dailyActiveChan <- store.StoreResult{Data: dailyActive, Err: err2}
|
||||
close(dailyActiveChan)
|
||||
}()
|
||||
|
||||
monthlyActiveChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
monthlyActive, err := a.Srv().Store.User().AnalyticsActiveCount(MONTH_MILLISECONDS, model.UserCountOptions{IncludeBotAccounts: false, IncludeDeleted: false})
|
||||
monthlyActiveChan <- store.StoreResult{Data: monthlyActive, Err: err}
|
||||
monthlyActive, err2 := a.Srv().Store.User().AnalyticsActiveCount(MONTH_MILLISECONDS, model.UserCountOptions{IncludeBotAccounts: false, IncludeDeleted: false})
|
||||
monthlyActiveChan <- store.StoreResult{Data: monthlyActive, Err: err2}
|
||||
close(monthlyActiveChan)
|
||||
}()
|
||||
|
||||
@@ -155,9 +155,9 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
||||
|
||||
// If in HA mode then aggregate all the stats
|
||||
if a.Cluster() != nil && *a.Config().ClusterSettings.Enable {
|
||||
stats, err := a.Cluster().GetClusterStats()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
stats, err2 := a.Cluster().GetClusterStats()
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
|
||||
totalSockets := a.TotalWebsocketConnections()
|
||||
@@ -231,29 +231,29 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
||||
|
||||
iHookChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
c, err := a.Srv().Store.Webhook().AnalyticsIncomingCount(teamId)
|
||||
iHookChan <- store.StoreResult{Data: c, Err: err}
|
||||
c, err2 := a.Srv().Store.Webhook().AnalyticsIncomingCount(teamId)
|
||||
iHookChan <- store.StoreResult{Data: c, Err: err2}
|
||||
close(iHookChan)
|
||||
}()
|
||||
|
||||
oHookChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
c, err := a.Srv().Store.Webhook().AnalyticsOutgoingCount(teamId)
|
||||
oHookChan <- store.StoreResult{Data: c, Err: err}
|
||||
c, err2 := a.Srv().Store.Webhook().AnalyticsOutgoingCount(teamId)
|
||||
oHookChan <- store.StoreResult{Data: c, Err: err2}
|
||||
close(oHookChan)
|
||||
}()
|
||||
|
||||
commandChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
c, err := a.Srv().Store.Command().AnalyticsCommandCount(teamId)
|
||||
commandChan <- store.StoreResult{Data: c, Err: err}
|
||||
c, nErr := a.Srv().Store.Command().AnalyticsCommandCount(teamId)
|
||||
commandChan <- store.StoreResult{Data: c, NErr: nErr}
|
||||
close(commandChan)
|
||||
}()
|
||||
|
||||
sessionChan := make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
count, err := a.Srv().Store.Session().AnalyticsSessionCount()
|
||||
sessionChan <- store.StoreResult{Data: count, NErr: err}
|
||||
count, err2 := a.Srv().Store.Session().AnalyticsSessionCount()
|
||||
sessionChan <- store.StoreResult{Data: count, NErr: err2}
|
||||
close(sessionChan)
|
||||
}()
|
||||
|
||||
@@ -263,15 +263,15 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
||||
if !skipIntensiveQueries {
|
||||
fileChan = make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
count, err := a.Srv().Store.Post().AnalyticsPostCount(teamId, true, false)
|
||||
fileChan <- store.StoreResult{Data: count, Err: err}
|
||||
count, err2 := a.Srv().Store.Post().AnalyticsPostCount(teamId, true, false)
|
||||
fileChan <- store.StoreResult{Data: count, Err: err2}
|
||||
close(fileChan)
|
||||
}()
|
||||
|
||||
hashtagChan = make(chan store.StoreResult, 1)
|
||||
go func() {
|
||||
count, err := a.Srv().Store.Post().AnalyticsPostCount(teamId, false, true)
|
||||
hashtagChan <- store.StoreResult{Data: count, Err: err}
|
||||
count, err2 := a.Srv().Store.Post().AnalyticsPostCount(teamId, false, true)
|
||||
hashtagChan <- store.StoreResult{Data: count, Err: err2}
|
||||
close(hashtagChan)
|
||||
}()
|
||||
}
|
||||
@@ -309,8 +309,8 @@ func (a *App) GetAnalytics(name string, teamId string) (model.AnalyticsRows, *mo
|
||||
rows[3].Value = float64(r.Data.(int64))
|
||||
|
||||
r = <-commandChan
|
||||
if r.Err != nil {
|
||||
return nil, r.Err
|
||||
if r.NErr != nil {
|
||||
return nil, model.NewAppError("GetAnalytics", "app.analytics.getanalytics.internal_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
rows[4].Value = float64(r.Data.(int64))
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user