diff options
author | Magnus Kessler <Magnus.Kessler@gmx.net> | 2016-10-27 10:02:02 +0100 |
---|---|---|
committer | Magnus Kessler <Magnus.Kessler@gmx.net> | 2016-10-27 10:10:45 +0100 |
commit | 72b9c272ccf38782bf6fbcc98810e66ae376a46b (patch) | |
tree | 654cc0ca8736be19f62c2b7e414b17e02c5e977f /python.d | |
parent | 7e5402d248b63c9ab62996d80184f0e5bd776b70 (diff) |
Fix occasional crashes in python plugins
Occasionally python plugins such as the nginx plugin crash with
```
Exception in thread local:
Traceback (most recent call last):
File "/usr/lib64/python3.4/threading.py", line 911, in _bootstrap_inner
self.run()
File "/usr/libexec/netdata/python.d/python_modules/base.py", line 166, in run
time.sleep(self.timetable['next'] - time.time())
ValueError: sleep length must be non-negative
```
Afterwards no further data is collected for the plugin until netdata
is restarted
Diffstat (limited to 'python.d')
-rw-r--r-- | python.d/python_modules/base.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/python.d/python_modules/base.py b/python.d/python_modules/base.py index 70c586f8e4..cb04274b85 100644 --- a/python.d/python_modules/base.py +++ b/python.d/python_modules/base.py @@ -163,7 +163,7 @@ class SimpleService(threading.Thread): self.error("Something wrong: ", str(e)) return if status: # handle retries if update failed - time.sleep(self.timetable['next'] - time.time()) + time.sleep(max (0, self.timetable['next'] - time.time())) self.retries_left = self.retries else: self.retries_left -= 1 |