Skip to content

Commit 2a33817

Browse files
fix: listen bucket event response should use response.readline() (#1195)
using response.stream() doesn't work with nginx due to unknown reasons, mostly perhaps how nginx writes the body of the response. Instead use response.readline() instead allows for reading the right amount of content() needed for events.
1 parent 4f35c22 commit 2a33817

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

minio/datatypes.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,6 @@ class EventIterable:
811811
def __init__(self, func):
812812
self._func = func
813813
self._response = None
814-
self._stream = None
815814

816815
def _close_response(self):
817816
"""Close response."""
@@ -826,7 +825,7 @@ def __iter__(self):
826825
def _get_records(self):
827826
"""Get event records from response stream."""
828827
try:
829-
line = self._stream.__next__().strip()
828+
line = self._response.readline().strip()
830829
if not line:
831830
return None
832831
if hasattr(line, 'decode'):
@@ -843,7 +842,6 @@ def __next__(self):
843842
while not records:
844843
if not self._response:
845844
self._response = self._func()
846-
self._stream = self._response.stream()
847845
records = self._get_records()
848846
return records
849847

0 commit comments

Comments
 (0)