SimpleService.py: microseconds between chart updates fixed
lgz committed
Oct 26, 2017 at 14:27 UTC
7799d8fdb20e7c41c5194b71ad3c7c168a211213
1 file changed
+7
-4
python.d/python_modules/bases/FrameworkServices/SimpleService.py
+7
-4
@@ -183,9 +183,6 @@ class SimpleService(Thread, PythonDLimitedLogger, OldVersionCompatibility, objec
183
if not self.manage_retries():
184
return
185
else:
186
- current_time = time()
187
- job.PREV_UPDATE = current_time
188
- job.ELAPSED = int((current_time - job.START_RUN) * 1e3)
186
job.RETRIES, job.PENALTY = 0, 0
187
safe_print(RUNTIME_CHART_UPDATE.format(job_name=self.name,
188
since_last=job.SINCE_UPDATE,
@@ -208,8 +205,14 @@ class SimpleService(Thread, PythonDLimitedLogger, OldVersionCompatibility, objec
205
return False
206
207
job = self._runtime_counters
208
+ current_time = time()
209
+
210
if job.PREV_UPDATE:
212
- job.SINCE_UPDATE = int((time() - job.PREV_UPDATE) * 1e6)
211
+ job.SINCE_UPDATE = int((current_time - job.PREV_UPDATE) * 1e6)
212
+ job.PREV_UPDATE = current_time
213
+ else:
214
+ job.PREV_UPDATE = current_time
215
+ job.ELAPSED = int((current_time - job.START_RUN) * 1e3)
216
217
charts_updated = False
218