Remove the remaining fields from *app.Server (#19113)
We move these fields to Channels: ``` uploadLockMapMut sync.Mutex uploadLockMap map[string]bool imgDecoder *imaging.Decoder imgEncoder *imaging.Encoder dndTaskMut sync.Mutex dndTask *model.ScheduledTask ``` I think this PR should conclue the initial phase of migrating stuff from Server to Channels. The remaining task would be to focus on continue to create the remaining services from the common things like users, teams, push notifications, clustering for other products to consume. https://community-daily.mattermost.com/boards/workspace/zyoahc9uapdn3xdptac6jb69ic/285b80a3-257d-41f6-8cf4-ed80ca9d92e5/495cdb4d-c13a-4992-8eb9-80cfee2819a4/87df1e15-588e-49ff-8bd1-ffa9651b8c82 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
6d361db638
Коммит
129f0aabd3
@@ -166,23 +166,23 @@ func (a *App) GetUploadSessionsForUser(userID string) ([]*model.UploadSession, *
|
||||
func (a *App) UploadData(c *request.Context, us *model.UploadSession, rd io.Reader) (*model.FileInfo, *model.AppError) {
|
||||
// prevent more than one caller to upload data at the same time for a given upload session.
|
||||
// This is to avoid possible inconsistencies.
|
||||
a.Srv().uploadLockMapMut.Lock()
|
||||
locked := a.Srv().uploadLockMap[us.Id]
|
||||
a.ch.uploadLockMapMut.Lock()
|
||||
locked := a.ch.uploadLockMap[us.Id]
|
||||
if locked {
|
||||
// session lock is already taken, return error.
|
||||
a.Srv().uploadLockMapMut.Unlock()
|
||||
a.ch.uploadLockMapMut.Unlock()
|
||||
return nil, model.NewAppError("UploadData", "app.upload.upload_data.concurrent.app_error",
|
||||
nil, "", http.StatusBadRequest)
|
||||
}
|
||||
// grab the session lock.
|
||||
a.Srv().uploadLockMap[us.Id] = true
|
||||
a.Srv().uploadLockMapMut.Unlock()
|
||||
a.ch.uploadLockMap[us.Id] = true
|
||||
a.ch.uploadLockMapMut.Unlock()
|
||||
|
||||
// reset the session lock on exit.
|
||||
defer func() {
|
||||
a.Srv().uploadLockMapMut.Lock()
|
||||
delete(a.Srv().uploadLockMap, us.Id)
|
||||
a.Srv().uploadLockMapMut.Unlock()
|
||||
a.ch.uploadLockMapMut.Lock()
|
||||
delete(a.ch.uploadLockMap, us.Id)
|
||||
a.ch.uploadLockMapMut.Unlock()
|
||||
}()
|
||||
|
||||
// fetch the session from store to check for inconsistencies.
|
||||
|
||||
Ссылка в новой задаче
Block a user