Improve session cleanup (#18123)
- We move logging statements to the upper layer. Store functions are low-level methods and should return error upwards rather than logging. - Used IN instead of any (array ()) which is equivalent. - Made the delay to be of type time.Duration and un-exported it. - Unexported the batch size constant. ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
2711262729
Коммит
d1b164ab1f
@@ -6281,19 +6281,20 @@ func (s *TimerLayerSessionStore) AnalyticsSessionCount() (int64, error) {
|
||||
return result, err
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) {
|
||||
func (s *TimerLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) error {
|
||||
start := timemodule.Now()
|
||||
|
||||
s.SessionStore.Cleanup(expiryTime, batchSize)
|
||||
err := s.SessionStore.Cleanup(expiryTime, batchSize)
|
||||
|
||||
elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second)
|
||||
if s.Root.Metrics != nil {
|
||||
success := "false"
|
||||
if true {
|
||||
if err == nil {
|
||||
success = "true"
|
||||
}
|
||||
s.Root.Metrics.ObserveStoreMethodDuration("SessionStore.Cleanup", success, elapsed)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *TimerLayerSessionStore) Get(ctx context.Context, sessionIDOrToken string) (*model.Session, error) {
|
||||
|
||||
Ссылка в новой задаче
Block a user