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

Return error instead of invalid JSON if response too large #4

Merged
merged 1 commit into from
Feb 11, 2021

Conversation

martinjaeger
Copy link
Contributor

With more data nodes than the buffer can fit, we got following ThingSet response:

Received Request (5 bytes): ?conf
:85 Content. { ... ,"Credit":0,"CustomMessage"}

ThingSet should always answer with valid JSON or an error message.

This commit fixes the issue. Now we get:

Received Request (5 bytes): ?conf
:E1 Response too large.

Copy link
Contributor

@JordanSilverman JordanSilverman left a comment

Choose a reason for hiding this comment

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

Strictly speaking this is good. However, I quite liked the previous characteristic where is would strip out the JSON value which is too large and still display the rest of the data. It was really useful in the case where I had a large buffer as a thingset object and when the buffer gets too full, I can still see the rest of the data in that category.

I'll approve anyway because I suppose this is the proper behaviour.

Copy link
Contributor

@azeemshatp azeemshatp left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks

@martinjaeger
Copy link
Contributor Author

Strictly speaking this is good. However, I quite liked the previous characteristic where is would strip out the JSON value which is too large and still display the rest of the data. It was really useful in the case where I had a large buffer as a thingset object and when the buffer gets too full, I can still see the rest of the data in that category.

Unfortunately it didn't always strip out the entire JSON key/value pair, but sometimes only the value. This has to be avoided, I think. But we could think about a new error code "partial response" (not sure if this should be considered an error or a success though).

I suggest to merge and open an enhancement issue for the partial success return code.

@martinjaeger martinjaeger merged commit bab79ae into master Feb 11, 2021
@martinjaeger martinjaeger deleted the json-long-string-handling branch May 24, 2021 09:01
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.

3 participants