diff --git a/backend/app/store/image/image.go b/backend/app/store/image/image.go index 6339d8e1..2bfea93b 100644 --- a/backend/app/store/image/image.go +++ b/backend/app/store/image/image.go @@ -154,6 +154,12 @@ func (s *Service) ExtractNonProxiedPictures(commentHTML string) (ids []string) { // Cleanup runs periodic cleanup with 1.5*ServiceParams.EditDuration. Blocking loop, should be called inside of goroutine by consumer func (s *Service) Cleanup(ctx context.Context) { + if s.EditDuration <= 0 { + log.Printf("[INFO] pictures cleanup disabled, edit duration is %v", s.EditDuration) + <-ctx.Done() + return + } + cleanupTTL := s.EditDuration * 15 / 10 // cleanup images older than 1.5 * EditDuration log.Printf("[INFO] start pictures cleanup, staging ttl=%v", cleanupTTL)