From d2c2c43e6a0fe38c33eb8560592c712cf42b99ab Mon Sep 17 00:00:00 2001 From: cedricbonhomme Date: Thu, 4 Nov 2010 21:43:42 +0100 Subject: Major improvement of the performance (concerning the management page). --- pyAggr3g470r.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'pyAggr3g470r.py') diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index d5dcc137..e8525526 100755 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -274,7 +274,10 @@ class Root: # Some statistics if self.articles: - self.top_words = utils.top_words(self.articles, n=50, size=int(word_size)) + if not hasattr(self, 'top_words') or os.path.getmtime(utils.sqlite_base) != self.last_top_words_update: + # only when the base has changed for best performance + self.top_words = utils.top_words(self.articles, n=50, size=int(word_size)) + self.last_top_words_update = os.path.getmtime(utils.sqlite_base) html += "

Statistics

\n
\n" if "oice" not in utils.IMPORT_ERROR: # counter object to count the number of -- cgit