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

Question: Can optimistic dispatchEvents be wrapped in Meteor.defer #346

Open
znewsham opened this issue Oct 25, 2019 · 2 comments
Open

Question: Can optimistic dispatchEvents be wrapped in Meteor.defer #346

znewsham opened this issue Oct 25, 2019 · 2 comments

Comments

@znewsham
Copy link

I've been seeing some method results be delayed unnecessarily by redis-oplog synchronously parsing the optimistic events from mutations. In one specific (particularly bad) case, my 1 second method call was delayed by an additional 5 seconds to allow redis to process these calls.

In the above scenario, I have two users viewing the same (fairly large) table. The table has approximately 300k rows, of which only 100 are shown at a time.

User 1 is filtering + sorting + limiting, using an index prefix. User 2 triggers some functionality that removes a record in this collection. The result of user 2's method call is delayed until redis-oplog re-queries the selector that user 1 is viewing - in a large collection, this can take some time.

Is there any reason that the optimistic functionality could not be handled in a Meteor.defer? This would allow the triggering method call to return immediately

@theodorDiaconu
Copy link
Contributor

@znewsham we can do it like that, however it will not work with optimistic updates. This was the reason it was done in sync.

@znewsham
Copy link
Author

@theodorDiaconu - I don't think I understand - user 1 doesn't need optimistic UI, since they didn't trigger the update - and potentially user 2 is viewing a much smaller dataset.

Is it possible to detect which observerhandles are associated with the requesting connection, and do those sync, and the handles that are associated with other connections, do those async?

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

No branches or pull requests

2 participants