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
@@ -1511,11 +1511,15 @@ func doCommandWebhookCleanup(s *Server) {
|
||||
}
|
||||
|
||||
const (
|
||||
SessionsCleanupBatchSize = 1000
|
||||
sessionsCleanupBatchSize = 1000
|
||||
)
|
||||
|
||||
func doSessionCleanup(s *Server) {
|
||||
s.Store.Session().Cleanup(model.GetMillis(), SessionsCleanupBatchSize)
|
||||
mlog.Debug("Cleaning up session store.")
|
||||
err := s.Store.Session().Cleanup(model.GetMillis(), sessionsCleanupBatchSize)
|
||||
if err != nil {
|
||||
mlog.Warn("Error while cleaning up sessions", mlog.Err(err))
|
||||
}
|
||||
}
|
||||
|
||||
func doCheckAdminSupportStatus(a *App, c *request.Context) {
|
||||
|
||||
Ссылка в новой задаче
Block a user