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

Avoid a packetstorm of device queries on startup #297

Merged
merged 1 commit into from
Nov 17, 2016

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented Nov 17, 2016

Two main changes here:

  • when we get an m.new_device event for a device we know about, ignore it
  • Batch up the m.new_device events received during initialsync and spam out all the queries at once.

This fixes element-hq/element-web#2274.

It also removes EncryptionAlgorithm.onNewDevice, so will break develop unless
#295 is landed.

Two main changes here:
 * when we get an m.new_device event for a device we know about, ignore it
 * Batch up the m.new_device events received during initialsync and spam out
   all the queries at once.
return this._baseApis.downloadKeysForUsers(
var r = this._doKeyDownloadForUsers(downloadUsers);
var promises = [];
downloadUsers.map(function(u) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be map or should it be forEach?

Copy link
Member Author

Choose a reason for hiding this comment

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

Array.forEach doesn't exist pre-ES5, and I don't think we have a polyfill for it. Is there a reason to avoid map ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, map is fine, was just curious.

@NegativeMjark
Copy link
Contributor

LGTM

@richvdh richvdh merged commit aefdacc into develop Nov 17, 2016
@richvdh richvdh deleted the rav/better_new_device_handling branch November 18, 2016 11:11
manuroe added a commit to matrix-org/matrix-ios-sdk that referenced this pull request Dec 2, 2016
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.

We make a bajillion /keys/query calls on startup
2 participants