Migrate store methods to use request.Context instead of context.Context (#24836)

Этот коммит содержится в:
Ben Schumacher
2023-10-11 13:08:55 +02:00
коммит произвёл GitHub
родитель 0d5a8b8841
Коммит 13c05a571f
127 изменённых файлов: 1030 добавлений и 921 удалений

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

@@ -5,7 +5,6 @@ package platform
import (
"bytes"
"context"
"encoding/json"
"fmt"
"net/http"
@@ -17,6 +16,7 @@ import (
"github.com/mattermost/mattermost/server/public/model"
"github.com/mattermost/mattermost/server/public/shared/mlog"
"github.com/mattermost/mattermost/server/public/shared/request"
"github.com/mattermost/mattermost/server/v8/channels/jobs"
"github.com/mattermost/mattermost/server/v8/channels/store/sqlstore"
"github.com/mattermost/mattermost/server/v8/channels/utils"
@@ -49,6 +49,8 @@ func (ps *PlatformService) License() *model.License {
}
func (ps *PlatformService) LoadLicense() {
c := request.EmptyContext(ps.logger)
// ENV var overrides all other sources of license.
licenseStr := os.Getenv(LicenseEnv)
if licenseStr != "" {
@@ -97,7 +99,7 @@ func (ps *PlatformService) LoadLicense() {
}
}
record, nErr := ps.Store.License().Get(sqlstore.WithMaster(context.Background()), licenseId)
record, nErr := ps.Store.License().Get(sqlstore.RequestContextWithMaster(c), licenseId)
if nErr != nil {
ps.logger.Error("License key from https://mattermost.com required to unlock enterprise features.", mlog.Err(nErr))
ps.SetLicense(nil)