MM-25394 session expired push notifications (#14732)

* new job type created that checks for expired mobile sessions and pushes notifications.

* only send session expired notifications if ExtendSessionLengthWithActivity is enabled.

* includes schema change:  field added to Sessions table
Этот коммит содержится в:
Doug Lauder
2020-06-17 14:47:54 -04:00
коммит произвёл GitHub
родитель 2bb6071f73
Коммит b317ee5cf2
29 изменённых файлов: 694 добавлений и 4 удалений

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

@@ -5211,6 +5211,22 @@ func (s *TimerLayerSessionStore) GetSessions(userId string) ([]*model.Session, *
return resultVar0, resultVar1
}
func (s *TimerLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, *model.AppError) {
start := timemodule.Now()
resultVar0, resultVar1 := s.SessionStore.GetSessionsExpired(thresholdMillis, mobileOnly, unnotifiedOnly)
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
if s.Root.Metrics != nil {
success := "false"
if resultVar1 == nil {
success = "true"
}
s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.GetSessionsExpired", success, elapsed)
}
return resultVar0, resultVar1
}
func (s *TimerLayerSessionStore) GetSessionsWithActiveDeviceIds(userId string) ([]*model.Session, *model.AppError) {
start := timemodule.Now()
@@ -5307,6 +5323,22 @@ func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceId string, expi
return resultVar0, resultVar1
}
func (s *TimerLayerSessionStore) UpdateExpiredNotify(sessionid string, notified bool) *model.AppError {
start := timemodule.Now()
resultVar0 := s.SessionStore.UpdateExpiredNotify(sessionid, notified)
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.UpdateExpiredNotify", success, elapsed)
}
return resultVar0
}
func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionId string, time int64) *model.AppError {
start := timemodule.Now()