MM-29107: Fix race in LDAP login (#16239)

* MM-29107: Fix race in LDAP login

We remove the goroutine to make things synchronous.

This removes the race and makes things more reliable.
It is already tested by TestLogin in ldap_test.go in -race mode.

https://mattermost.atlassian.net/browse/MM-29107

```release-note
NONE
```

* Address review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Agniva De Sarker
2020-11-20 18:07:31 +05:30
коммит произвёл GitHub
родитель 26676953a4
Коммит 4cdf239139
3 изменённых файлов: 5 добавлений и 3 удалений

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

@@ -217,8 +217,10 @@ func (a *App) DoLogin(w http.ResponseWriter, r *http.Request, user *model.User,
a.SetSession(session)
if a.Srv().License() != nil && *a.Srv().License().Features.LDAP && a.Ldap() != nil {
userVal := *user
sessionVal := *session
a.Srv().Go(func() {
a.Ldap().UpdateProfilePictureIfNecessary(*user, session)
a.Ldap().UpdateProfilePictureIfNecessary(userVal, sessionVal)
})
}