-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: Improved large resource handling #243
Conversation
// truncate domSnapshot for the logs if it's very large | ||
let domSnapshotLog = request.body.domSnapshot | ||
if (domSnapshotLog.length > Constants.MAX_LOG_LENGTH) { | ||
domSnapshotLog = domSnapshotLog.substring(0, Constants.MAX_LOG_LENGTH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you'll like this one @Robdel12. We'll no longer spit out huge logs that are 99% the domSnapshot
content.
9301dbb
to
45507a7
Compare
@@ -55,6 +56,13 @@ export default class ResponseService extends PercyClientService { | |||
return | |||
} | |||
|
|||
const responseBodySize = (await response.buffer()).length | |||
if (responseBodySize > Constants.MAX_FILE_SIZE_BYTES) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per discussion, let's reorganize this to stat
the local file copy afterward, instead of reading the buffer and checking it here before writing the local copy (ie. optimize for the 99% case of not skipping, and use stat because it's fast and avoids the double buffer read)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed with 941db82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🌮
# [0.7.0](v0.6.0...v0.7.0) (2019-06-06) ### Features * Improved large resource handling ([#243](#243)) ([4681425](4681425))
This PR:
You'll see logs like this in the integration test run:
That is excepted behavior. Graceful handling of a large DOM and warning you about it.
This PR also drops large resources gracefully and early. If you have
LOG_LEVEL=debug
set you will see in the logs something like this: