Module: check_mk
Branch: master
Commit: 5a47fafb9f512aa386a1beb42bf669d686b26743
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5a47fafb9f512a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Dec 11 22:01:11 2018 +0100
Minor cleanup: Compute cache file age only once
Change-Id: I31941b7e21528d90ac99ba8c57b20b8d10db8eed
---
cmk_base/data_sources/abstract.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmk_base/data_sources/abstract.py b/cmk_base/data_sources/abstract.py
index d181e69..61becc9 100644
--- a/cmk_base/data_sources/abstract.py
+++ b/cmk_base/data_sources/abstract.py
@@ -207,10 +207,10 @@ class DataSource(object):
return
may_use_outdated = config.simulation_mode or self._use_outdated_cache_file
- if not may_use_outdated and cmk_base.utils.cachefile_age(
- cachefile) > self._max_cachefile_age:
+ cachefile_age = cmk_base.utils.cachefile_age(cachefile)
+ if not may_use_outdated and cachefile_age > self._max_cachefile_age:
self._logger.debug("Not using cache (Too old. Age is %d sec, allowed is
%s sec)" %
- (cmk_base.utils.cachefile_age(cachefile),
self._max_cachefile_age))
+ (cachefile_age, self._max_cachefile_age))
return
# TODO: Use some generic store file read function to generalize error handling,