-
Notifications
You must be signed in to change notification settings - Fork 135
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
Adding 206 response handling from Breeze #752
Conversation
Adding task to clean old files
envelopes.forEach(envelope => { | ||
var payload: string = this._stringify(envelope); | ||
if (typeof payload !== "string") { | ||
return; |
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.
If there is a single "invalid" envelope that can't be stringified, (say in the middle of the payload), won't this case only half the batch to be sent?
Not that I can think of a normal case where JSON.stringify() would fail... Just looking for corner cases.
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.
We want to drop the individual "wrong" event and continue with others, I'm trying to keep previous logic, this change is mainly focused on having the envelopes available in this class instead of payload like before, allowing us to filter them for retriable response codes.
Library/Sender.ts
Outdated
|
||
// Mode 600 is w/r for creator and no read access for others (only applies on *nix) | ||
// For Windows, ACL rules are applied to the entire directory (see logic in _confirmDirExists and _applyACLRules) | ||
Logging.info(Sender.TAG, "saving data to disk at: " + fileFullPath); | ||
fs.writeFile(fileFullPath, payload, { mode: 0o600 }, (error) => this._onErrorHelper(error)); | ||
fs.writeFile(fileFullPath, JSON.stringify(envelopes), { mode: 0o600 }, (error) => this._onErrorHelper(error)); |
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.
2 questions
- I'm assuming that we don't need to worry about back compat for loading previous version persisted items
- Based on the try/catch stringify check when sending requests do we want to do that here as well so entire batches don't get dropped.
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.
Yours also explicitly converting the string to utf8 prior to reading -- should ensure that it's written as such also.
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.
We will not support old AppInsights files because the telemetry was stored differently, this change will be part of major version update of the SDK, older files will be automatically cleaned after expiration is reached
Adding task to clean old files