Code formatting + fixed debug update_every
paulfantom committed
Jun 22, 2016 at 12:40 UTC
0bdf2f96b5c5d41ee4bcfb46c2d6c4ff9ef7d82d
1 file changed
+9
-4
plugins.d/python.d.plugin
+9
-4
@@ -425,7 +425,10 @@ class PythonCharts(object):
425
since_last = 0
426
else:
427
since_last = int((t_start - job.timetable['last']) * 1000000)
428
- debug(job.chart_name + " ready to run, after " + str(int((t_start - job.timetable['last']) * 1000)) + " ms (update_every: " + str(job.timetable['freq'] * 1000) + " ms, latency: " + str(int((t_start - job.timetable['next']) * 1000)) + " ms)")
428
+ debug(job.chart_name +
429
+ " ready to run, after " + str(int((t_start - job.timetable['last']) * 1000)) +
430
+ " ms (update_every: " + str(job.timetable['freq'] * 1000) +
431
+ " ms, latency: " + str(int((t_start - job.timetable['next']) * 1000)) + " ms)")
432
if not job.update(since_last):
433
if job.retries_left <= 0:
434
self._stop(job, "update failed")
@@ -504,6 +507,7 @@ def parse_cmdline(directory, *commands):
507
global OVERRIDE_UPDATE_EVERY
508
global BASE_CONFIG
509
510
+ changed_update = False
511
mods = []
512
for cmd in commands[1:]:
513
if cmd == "check":
@@ -517,11 +521,12 @@ def parse_cmdline(directory, *commands):
521
else:
522
try:
523
BASE_CONFIG['update_every'] = int(cmd)
520
- if DEBUG_FLAG:
521
- OVERRIDE_UPDATE_EVERY = True
522
- debug(PROGRAM, "overriding update interval to", str(int(cmd)))
524
+ changed_update = True
525
except ValueError:
526
pass
527
+ if changed_update and DEBUG_FLAG:
528
+ OVERRIDE_UPDATE_EVERY = True
529
+ debug(PROGRAM, "overriding update interval to", str(int(cmd)))
530
531
debug("started from", commands[0], "with options:", *commands[1:])
532