Skip to content

Conversation

@Praveenrajmani
Copy link
Collaborator

The server streams an empty string (" ") until an action hits the bucket,
In this case JSONEncodeError exception is thrown for every json.loads(" ") , So the loop continues here and polls the request for every catch .

@nitisht nitisht requested review from ebozduman and poornas June 7, 2018 10:08
minio/api.py Outdated
event = json.loads(line)
if event['Records'] is not None:
yield event
if len(line.strip()) > 0:
Copy link
Collaborator

@ebozduman ebozduman Jun 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is just a preference, but IMHO, if line.strip(): is better than checking the length of the stripped line.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes @ebozduman this is much simpler. Changing it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ebozduman Done

poornas
poornas previously approved these changes Jun 7, 2018
Prevents polling the request for every `JSONDecodeError` exception catch in the loop.
Copy link
Collaborator

@ebozduman ebozduman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@poornas poornas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@harshavardhana harshavardhana merged commit 06aefef into minio:master Jun 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants