@cryptotaxi247 / netdata-1 / commits / 06ddc6e8a

prevent frequent opening of log files

paulfantom committed Jul 2, 2016 at 18:56 UTC 06ddc6e8a6e6a7e13016177016c4483e922b098a
2 files changed +4 -6
python.d/apache_cache.chart.py
+2 -6
@@ -47,9 +47,5 @@ class Service(LogService):
47 elif "cache miss" in line:
48 miss += 1
49
50 - total = hit + miss
51 - if total == 0:
52 - return None
53 -
54 - return {'hit': int(hit/float(total) * 100),
55 - 'miss': int(miss/float(total) * 100)}
50 + return {'hit': hit,
51 + 'miss': miss}
python.d/python_modules/base.py
+2
@@ -438,6 +438,8 @@ class LogService(SimpleService):
438 try:
439 if os.path.getsize(self.log_path) < self._last_position:
440 self._last_position = 0
441 + elif os.path.getsize(self.log_path) == self._last_position:
442 + return None
443 with open(self.log_path, "r") as fp:
444 fp.seek(self._last_position)
445 for i, line in enumerate(fp):