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

⚡️ Deduplicate Backend.getOps() calls #680

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

alecgibson
Copy link
Collaborator

Calls to Backend.getOps() can be quite expensive. In order to minimize the impact of these calls on the server, this change deduplicates concurrent calls with the same arguments, and makes only a single call, then invoking all the callbacks with the single result.

Calls to `Backend.getOps()` can be quite expensive. In order to minimize
the impact of these calls on the server, this change deduplicates
concurrent calls with the same arguments, and makes only a single call,
then invoking all the callbacks with the single result.
@coveralls
Copy link

coveralls commented Aug 27, 2024

Coverage Status

coverage: 97.458% (+0.01%) from 97.445%
when pulling 599d175 on deduplicate-get-ops
into 297ce5d on master.

 - Clean up `arguments` -> `Array`
return function() {
var args = Array.prototype.slice.call(arguments);
var callback = args.pop();
var argString = JSON.stringify(args);
Copy link
Contributor

Choose a reason for hiding this comment

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

agent.custom could in theory contain non-JSON-serializable objects, and also in practice could result in calls from different clients not being deduped.

We'll have to think on this a bit more - Alec suggested possibly moving it to sharedb-mongo instead

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.

3 participants