From 6db01d718f189251988c5658ad434f18498ea38b Mon Sep 17 00:00:00 2001 From: paulfantom Date: Sat, 18 Jun 2016 13:53:09 +0200 Subject: [PATCH] handling of debug interval --- plugins.d/python.d.plugin | 5 +++++ python.d/python_modules/base.py | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/plugins.d/python.d.plugin b/plugins.d/python.d.plugin index e7dfc525..dd39cea5 100755 --- a/plugins.d/python.d.plugin +++ b/plugins.d/python.d.plugin @@ -45,6 +45,11 @@ class PythonCharts(object): # good economy and prosperity: self.jobs = self._create_jobs(configured_modules) + if DEBUG_FLAG: + if interval is None: + interval = 1 + for job in self.jobs: + job._create_timetable(interval) def _create_jobs(self,modules): diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py index 05dc49c4..9c1f76c3 100644 --- a/python.d/python_modules/base.py +++ b/python.d/python_modules/base.py @@ -22,11 +22,13 @@ class BaseService(object): self.retries = int(config['retries']) self.retries_left = self.retries - def _create_timetable(self): + def _create_timetable(self,freq=None): + if freq is None: + freq = self.update_every now = time() self.timetable = {'last' : now, - 'next' : now - (now % self.update_every) + self.update_every, - 'freq' : self.update_every} + 'next' : now - (now % freq) + freq, + 'freq' : freq} def error(self, msg, exception=""): -- 2.39.2