-
Notifications
You must be signed in to change notification settings - Fork 945
Add Query to Target ID Map #2179
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
Add Query to Target ID Map #2179
Conversation
…base-js-sdk into mrschmidt/indexfree-master
…base-js-sdk into mrschmidt/indexfree-master
return PersistencePromise.resolve(); | ||
} | ||
}); | ||
const targetId = this.targetIdByQuery.get(query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We now have a map to look up targetIds for active queries, so we no longer need to go to the QueryCache.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!
cd2a0e2
to
5765d98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
return PersistencePromise.resolve(); | ||
} | ||
}); | ||
const targetId = this.targetIdByQuery.get(query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call!
This PR replaces the O(n) loop in getQueryData() with a key lookup in an ObjectMap. This follows the precedent in SyncEngine (and maybe eventually leads us down the path of merging the different query tracking mechanisms).