File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -85,16 +85,20 @@ def _read_bytes(self, num_bytes):
85
85
self .reinit ()
86
86
87
87
while bytes_left :
88
+
88
89
try :
89
90
data = self ._sock .recv (min (bytes_left , 4096 ))
91
+
92
+ # Receiving empty string from recv signals
93
+ # that the socket is in error. we will never get
94
+ # more data from this socket
95
+ if data == '' :
96
+ raise socket .error ('Not enough data to read message -- did server kill socket?' )
97
+
90
98
except socket .error :
91
99
log .exception ('Unable to receive data from Kafka' )
92
100
self ._raise_connection_error ()
93
101
94
- if data == '' :
95
- log .error ("Not enough data to read this response" )
96
- self ._raise_connection_error ()
97
-
98
102
bytes_left -= len (data )
99
103
log .debug ("Read %d/%d bytes from Kafka" , num_bytes - bytes_left , num_bytes )
100
104
responses .append (data )
You can’t perform that action at this time.
0 commit comments