15249 sync.pool (#16103)
* use sync.pool for session * added back to sync pool * reverted change * added a new line * added back session object * added back session object * added back session object * revert * refactored into function * added the session object back into the pool * work in progress * work in progress * work in progress * code review comments Co-authored-by: Arjuna Marambe <arjunam@buildxact.com> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
7f8850398c
Коммит
5f16fc644a
@@ -130,6 +130,8 @@ func (a *App) servePluginRequest(w http.ResponseWriter, r *http.Request, handler
|
||||
r.Header.Del("Mattermost-User-Id")
|
||||
if token != "" {
|
||||
session, err := a.GetSession(token)
|
||||
defer ReturnSessionToPool(session)
|
||||
|
||||
csrfCheckPassed := false
|
||||
|
||||
if err == nil && cookieAuth && r.Method != "GET" {
|
||||
@@ -180,7 +182,7 @@ func (a *App) servePluginRequest(w http.ResponseWriter, r *http.Request, handler
|
||||
csrfCheckPassed = true
|
||||
}
|
||||
|
||||
if session != nil && err == nil && csrfCheckPassed {
|
||||
if (session != nil && session.Id != "") && err == nil && csrfCheckPassed {
|
||||
r.Header.Set("Mattermost-User-Id", session.UserId)
|
||||
context.SessionId = session.Id
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user