MM-61225: Revert session pooling (#28901)

This originated from https://github.com/mattermost/mattermost/issues/15249.

However, the original idea was discarded https://github.com/mattermost/mattermost/issues/15249#issuecomment-709713065
as being too complicated to implement. Then I had another
idea to implement it just for session objects.

My thinking was that since every single request allocates a new
session struct, it would be good to use a sync.Pool for that.

However, 4 years later, now we know that the primary bottleneck
in app performance comes from websocket event marshalling.
Therefore, while it would be good to do this, it is difficult
to do it correctly (as shown by the numerous racy tests).

Hence, reverting this.

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2024-10-24 22:50:44 +05:30
коммит произвёл GitHub
родитель a8cf496e31
Коммит 6075b1cd4e
12 изменённых файлов: 21 добавлений и 86 удалений

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

@@ -17,21 +17,20 @@ import (
// SyncLdap starts an LDAP sync job.
// If includeRemovedMembers is true, then members who left or were removed from a team/channel will
// be re-added; otherwise, they will not be re-added.
func (a *App) SyncLdap(rctx request.CTX, includeRemovedMembers bool) {
rctx = rctx.Clone()
func (a *App) SyncLdap(c request.CTX, includeRemovedMembers bool) {
a.Srv().Go(func() {
if license := a.Srv().License(); license != nil && *license.Features.LDAP {
if !*a.Config().LdapSettings.EnableSync {
rctx.Logger().Error("LdapSettings.EnableSync is set to false. Skipping LDAP sync.")
c.Logger().Error("LdapSettings.EnableSync is set to false. Skipping LDAP sync.")
return
}
ldapI := a.Ldap()
if ldapI == nil {
rctx.Logger().Error("Not executing ldap sync because ldap is not available")
c.Logger().Error("Not executing ldap sync because ldap is not available")
return
}
ldapI.StartSynchronizeJob(rctx, false, includeRemovedMembers)
ldapI.StartSynchronizeJob(c, false, includeRemovedMembers)
}
})
}