[damned-lies] Optimize reduced po computation without filter



commit 1c5cc960b4ccb5707d22495d4c5f9bd8a98bba03
Author: Pino Toscano <toscano pino tiscali it>
Date:   Sat Apr 27 08:37:21 2019 +0200

    Optimize reduced po computation without filter
    
    In case a domain has no reduction filter set, directly set part_po as
    full_po.
    
    This way, it is possible to avoid creating a Path, trying to get the
    statistics of and unlink a non-existing file.  As result, few syscalls
    (a couple of stat's and one unlink) are avoided.

 stats/models.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/stats/models.py b/stats/models.py
index 193188de..ad93c597 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -1543,7 +1543,7 @@ class Statistics(models.Model):
                 self.save()
 
             # Try to compute a reduced po file
-            if (self.full_po.fuzzy + self.full_po.untranslated) > 0 and not self.branch.is_archive_only():
+            if (self.full_po.fuzzy + self.full_po.untranslated) > 0 and not self.branch.is_archive_only() 
and self.domain.red_filter != '-':
                 # Generate partial_po and store partial stats
                 if self.full_po.path.endswith('.pot'):
                     part_po_path = Path(self.full_po.path[:-3] + "reduced.pot")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]