Skip to content

Commit 06aefef

Browse files
Praveenrajmaniharshavardhana
authored andcommitted
Fix listen_bucket_notification (#659)
Prevents polling the request for every `JSONDecodeError` exception catch in the loop.
1 parent fd92f68 commit 06aefef

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

minio/api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,10 @@ def listen_bucket_notification(self, bucket_name, prefix='', suffix='',
507507
query=query, preload_content=False)
508508
try:
509509
for line in response.stream():
510-
event = json.loads(line)
511-
if event['Records'] is not None:
512-
yield event
510+
if line.strip():
511+
event = json.loads(line)
512+
if event['Records'] is not None:
513+
yield event
513514
except JSONDecodeError:
514515
response.close()
515516
continue

0 commit comments

Comments
 (0)