You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that you have a json indent + line split hack to break the response into smaller sized chunks so that any single socket write operation doesn't overflow.
I think a better solution is to pick a reasonably safe chunk size, say 32 bytes at a time, and then just wrap the json output in a generator:
There is something aesthetically pleasing, at least to me, about yielding the data line-by-line.
Your suggested change would consume less CPU and RAM (well, it would if you used a bigger chunk size than 32 bytes, which is much smaller than necessary ;-)), but in the vast majority of cases the difference would be so negligible as to be effectively meaningless.
Your suggested change would increase the line count and complexity of the app without increasing functionality.
I am hopeful the bug in wsgiref will eventually be fixed, at which point the workaround in Coal Mine can be removed. Given that, I'm not sure I see the value in making the workaround more complex as you propose.
I see that you have a json indent + line split hack to break the response into smaller sized chunks so that any single socket write operation doesn't overflow.
I think a better solution is to pick a reasonably safe chunk size, say 32 bytes at a time, and then just wrap the json output in a generator:
The text was updated successfully, but these errors were encountered: