Visitar URL original
non-blocking `SocketService` · gitqueue/netdata@4db9373 · GitHub
Skip to content

Commit 4db9373

Browse files
committed
non-blocking SocketService
1 parent b6cfb65 commit 4db9373

4 files changed

Lines changed: 12 additions & 4 deletions

File tree

‎plugins.d/python.d.plugin‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ class PythonCharts(object):
341341
if job.override_name is not None:
342342
new_name = job.__module__ + '_' + job.override_name
343343
if new_name in overridden:
344-
msg.error(job.chart_name + " already exists. Stopping '" + job.name + "'")
344+
msg.error(job.override_name + " already exists. Stopping '" + job.name + "'")
345345
self._stop(job)
346346
i -= 1
347347
else:
@@ -351,9 +351,10 @@ class PythonCharts(object):
351351
overridden.append(job.chart_name)
352352
except Exception:
353353
pass
354-
except AttributeError:
354+
except AttributeError as e:
355355
self._stop(job)
356356
msg.error(job.chart_name, "cannot find check() function.")
357+
msg.debug(str(e))
357358
except (UnboundLocalError, Exception) as e:
358359
msg.error(job.chart_name, str(e))
359360
self._stop(job)

‎python.d/python_modules/base.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,11 +574,13 @@ def _receive(self):
574574
buf = self._sock.recv(4096)
575575
if len(buf) == 0 or buf is None:
576576
break
577+
577578
data += buf.decode()
578579
if self._check_raw_data(data):
579580
break
580581
else:
581-
# self._disconnect()
582+
self.error("Socket timed out.")
583+
self._disconnect()
582584
break
583585

584586
return data

‎python.d/redis.chart.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def __init__(self, configuration=None, name=None):
6767
self.order = ORDER
6868
self.definitions = CHARTS
6969
self._keep_alive = True
70+
self.chart_name = ""
7071

7172
def _get_data(self):
7273
"""

‎python.d/squid.chart.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,11 @@ def _check_raw_data(self, data):
8888
else:
8989
self._keep_alive = False
9090

91-
if "client" in data and "server.all" in data:
91+
# if "client" in data and "server.all" in data:
92+
# return True
93+
# else:
94+
# return False
95+
if data[-7:] == "\r\n0\r\n\r\n":
9296
return True
9397
else:
9498
return False

0 commit comments

Comments
 (0)