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

Adding 206 response handling from Breeze #752

Merged
merged 3 commits into from
Apr 16, 2021

Conversation

hectorhdzg
Copy link
Member

Adding task to clean old files

Adding task to clean old files
@hectorhdzg hectorhdzg changed the title Adding 206 response from Breeze handling Adding 206 response handling from Breeze Apr 14, 2021
envelopes.forEach(envelope => {
var payload: string = this._stringify(envelope);
if (typeof payload !== "string") {
return;
Copy link

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.

Copy link
Member Author

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.


// 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));
Copy link

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.

Copy link

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.

Copy link
Member Author

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

@hectorhdzg hectorhdzg merged commit acf85ee into develop Apr 16, 2021
@hectorhdzg hectorhdzg deleted the hectorhdzg/partialcontent branch May 25, 2021 18:02
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.

None yet

2 participants