[AI assisted]: Improve system console statistics performance (#29899)

```release-note
NONE
```

Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
Этот коммит содержится в:
Agniva De Sarker
2025-02-04 21:54:01 +05:30
коммит произвёл GitHub
родитель 6046a304b2
Коммит ae9e6174e5
45 изменённых файлов: 1052 добавлений и 407 удалений

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

@@ -2182,6 +2182,7 @@ func TestImportimportMultiplePostLines(t *testing.T) {
require.Nil(t, err, "Failed to get user from database.")
// Count the number of posts in the testing team.
require.NoError(t, th.App.Srv().Store().Post().RefreshPostStats())
initialPostCount, nErr := th.App.Srv().Store().Post().AnalyticsPostCount(&model.PostCountOptions{TeamId: team.Id})
require.NoError(t, nErr)
@@ -2859,6 +2860,7 @@ func TestImportimportMultiplePostLines(t *testing.T) {
require.Nil(t, err, "Failed to get channel from database.")
// Count the number of posts in the team2.
require.NoError(t, th.App.Srv().Store().Post().RefreshPostStats())
initialPostCountForTeam2, nErr := th.App.Srv().Store().Post().AnalyticsPostCount(&model.PostCountOptions{TeamId: team2.Id})
require.NoError(t, nErr)
@@ -3239,6 +3241,7 @@ func TestImportImportPost(t *testing.T) {
require.Nil(t, appErr, "Failed to get user from database.")
// Count the number of posts in the testing team.
require.NoError(t, th.App.Srv().Store().Post().RefreshPostStats())
initialPostCount, nErr := th.App.Srv().Store().Post().AnalyticsPostCount(&model.PostCountOptions{TeamId: team.Id})
require.NoError(t, nErr)
@@ -4194,6 +4197,7 @@ func TestImportImportDirectPost(t *testing.T) {
directChannel = channel
// Get the number of posts in the system.
require.NoError(t, th.App.Srv().Store().Post().RefreshPostStats())
result, err := th.App.Srv().Store().Post().AnalyticsPostCount(&model.PostCountOptions{})
require.NoError(t, err)
initialPostCount := result
@@ -4664,6 +4668,7 @@ func TestImportImportDirectPost(t *testing.T) {
groupChannel = channel
// Get the number of posts in the system.
require.NoError(t, th.App.Srv().Store().Post().RefreshPostStats())
result, nErr := th.App.Srv().Store().Post().AnalyticsPostCount(&model.PostCountOptions{})
require.NoError(t, nErr)
initialPostCount = result