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

Stop keep alive when sync is aborted #3686

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1604,7 +1604,13 @@ export class SyncApi {
success();
},
(err) => {
if (err.httpStatus == 400 || err.httpStatus == 404) {
if (!this.running) {
clearTimeout(this.keepAliveTimer);
if (this.connectionReturnedDefer) {
this.connectionReturnedDefer.reject();
this.connectionReturnedDefer = undefined;
}
Comment on lines +1607 to +1612
Copy link
Member

Choose a reason for hiding this comment

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

In any case, the new code needs more comments to explain what is going on.

please do give this code some comments to explain what it is doing. Imagine you are unfamiliar with this code and trying to understand it. When does it happen, why is this the right thing to do? Are there other places in this file that have similar logic that it might be helpful to link to?

} else if (err.httpStatus == 400 || err.httpStatus == 404) {
// treat this as a success because the server probably just doesn't
// support /versions: point is, we're getting a response.
// We wait a short time though, just in case somehow the server
Expand Down