MM-23935 extend session expiry on user activity (#14275)

* MM-23935  extend session expiry on user activity

- if user types anything before a session expires the session will be extended to now + session length

- ensures new session expiries are not written to DB too frequently

- new session store func for updating session ExpiresAt

- session length defaults for mobile and web/ldap changed from 180 days to 30 days
Этот коммит содержится в:
Doug Lauder
2020-05-06 15:41:10 -04:00
коммит произвёл GitHub
родитель 58305b080f
Коммит 5e59b5f70c
18 изменённых файлов: 349 добавлений и 5 удалений

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

@@ -5291,6 +5291,22 @@ func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceId string, expi
return resultVar0, resultVar1
}
func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) *model.AppError {
start := timemodule.Now()
resultVar0 := s.SessionStore.UpdateExpiresAt(sessionId, time)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar0 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.UpdateExpiresAt", success, elapsed)
}
return resultVar0
}
func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionId string, time int64) *model.AppError {
start := timemodule.Now()