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
@@ -7550,9 +7550,23 @@ func (s *RetryLayerSessionStore) AnalyticsSessionCount() (int64, error) {
|
||||
|
||||
}
|
||||
|
||||
func (s *RetryLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) {
|
||||
func (s *RetryLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) error {
|
||||
|
||||
s.SessionStore.Cleanup(expiryTime, batchSize)
|
||||
tries := 0
|
||||
for {
|
||||
err := s.SessionStore.Cleanup(expiryTime, batchSize)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if !isRepeatableError(err) {
|
||||
return err
|
||||
}
|
||||
tries++
|
||||
if tries >= 3 {
|
||||
err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures")
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user