Tests for fileCache

This commit is contained in:
Philipp Heckel 2022-01-08 12:14:43 -05:00
parent e7c19a2bad
commit cefe276ce5
7 changed files with 101 additions and 25 deletions

View file

@ -833,13 +833,15 @@ func (s *Server) updateStatsAndPrune() {
}
// Delete expired attachments
ids, err := s.cache.AttachmentsExpired()
if err == nil {
if err := s.fileCache.Remove(ids); err != nil {
log.Printf("error while deleting attachments: %s", err.Error())
if s.fileCache != nil {
ids, err := s.cache.AttachmentsExpired()
if err == nil {
if err := s.fileCache.Remove(ids...); err != nil {
log.Printf("error while deleting attachments: %s", err.Error())
}
} else {
log.Printf("error retrieving expired attachments: %s", err.Error())
}
} else {
log.Printf("error retrieving expired attachments: %s", err.Error())
}
// Prune message cache