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 syncing when the token is invalid #895

Merged
merged 2 commits into from Apr 15, 2019

Conversation

turt2live
Copy link
Member

@turt2live turt2live requested a review from a team April 15, 2019 03:40
Copy link
Contributor

@bwindels bwindels left a comment

Choose a reason for hiding this comment

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

Thanks, lgtm!

src/sync.js Outdated
@@ -462,6 +462,16 @@ SyncApi.prototype.sync = function() {
let savedSyncPromise = Promise.resolve();
let savedSyncToken = null;

async function shouldAbortSync(err) {
Copy link
Contributor

Choose a reason for hiding this comment

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

can remove async keyword?

src/sync.js Outdated
@@ -877,6 +889,12 @@ SyncApi.prototype._onSyncError = function(err, syncOptions) {
console.error("/sync error %s", err);
console.error(err);

if (err.errcode === "M_UNKNOWN_TOKEN") {
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid duplication with if (shouldAbortSync(err)) { return; } here?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is a different function, but there's nothing stopping the function from being defined in a higher scope I guess.

@turt2live turt2live merged commit b5779f8 into develop Apr 15, 2019
@turt2live turt2live deleted the travis/stop-client-on-logout branch April 15, 2019 17:30
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.

MatrixClient is not stopped when the token no longer works
2 participants