Remove global variables and fix racy test (#18733)

https://community.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4?c=65b44de0-1a9c-4643-84c1-5d803593f314

This PR improves on two things at once:
- It fixes the race condition by removing global variables.
- But instead of moving them to Server, it moves them inside Channels,
thereby making one more step towards the multi-product architecture.

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2021-10-18 19:38:16 +05:30
коммит произвёл GitHub
родитель c5811939c4
Коммит 2a07d4641a
2 изменённых файлов: 20 добавлений и 20 удалений

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

@@ -4,6 +4,7 @@
package app
import (
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/services/imageproxy"
)
@@ -12,6 +13,13 @@ type Channels struct {
srv *Server
imageProxy *imageproxy.ImageProxy
// cached counts that are used during notice condition validation
cachedPostCount int64
cachedUserCount int64
cachedDBMSVersion string
// previously fetched notices
cachedNotices model.ProductNotices
}
func init() {