Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix listen_bucket_notification #657

Merged
merged 2 commits into from
Jun 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions minio/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@
import itertools
import codecs

try:
from json.decoder import JSONDecodeError
except ImportError:
JSONDecodeError = ValueError

# Dependencies
import urllib3
import certifi
Expand Down Expand Up @@ -474,7 +479,7 @@ def listen_bucket_notification(self, bucket_name, prefix='', suffix='',
Yeilds new event notifications on a bucket, caller should iterate
to read new notifications.

NOTE: Notification is retried in case of `SyntaxError` otherwise
NOTE: Notification is retried in case of `JSONDecodeError` otherwise
the function raises an exception.

:param bucket_name: Bucket name to listen event notifications from.
Expand Down Expand Up @@ -505,7 +510,7 @@ def listen_bucket_notification(self, bucket_name, prefix='', suffix='',
event = json.loads(line)
if event['Records'] is not None:
yield event
except SyntaxError:
except JSONDecodeError:
response.close()
continue

Expand Down