From c2e99e6efbb2403dbf26779761a1cda5adcbcde6 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 26 Jul 2019 01:33:14 -0400 Subject: [PATCH] Purge cache partition before deleting them Signed-off-by: Roberto Rosario --- mayan/apps/file_caching/models.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mayan/apps/file_caching/models.py b/mayan/apps/file_caching/models.py index 8ea22ee4aa..64f8513563 100644 --- a/mayan/apps/file_caching/models.py +++ b/mayan/apps/file_caching/models.py @@ -167,6 +167,10 @@ class CachePartition(models.Model): logger.debug('unable to obtain lock: %s' % lock_id) raise + def delete(self, *args, **kwargs): + self.purge() + return super(CachePartition, self).delete(*args, **kwargs) + def get_file(self, filename): try: return self.files.get(filename=filename)