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

this.block in publish only work for the first time #10

Open
williamli opened this issue Dec 9, 2015 · 2 comments
Open

this.block in publish only work for the first time #10

williamli opened this issue Dec 9, 2015 · 2 comments

Comments

@williamli
Copy link

so i have something like

Meteor.publish('products/inCategory/withLimitAndSort', function (cat, subCat, limit, sort) {
  this.unblock();
  console.log('publish: products/inCategory/withLimitAndSort', cat, subCat, limit, sort);
  var productFind = {...

I have a loop that subscribe to it for N times for N products.

When these are subscribed, in the terminal console, I can see the console.log messages fly in and the web app can subscribed without being blocked, the whole process took less than 2 seconds

I only have problem when user try to login / logout of the system. Meteor will resubscribe to everything when Meteor.user status changes.

When meteor reconnects all the subscriptions, it seems to be doing it as blocked calls. I can see in terminal's log that these subscriptions are handled one by one and took at least 5 seconds for each of the
product. (i.e. if I have subscribed to 50 times, it will take 50 * 5 seconds).

Meteor's login / logout process also stuck in isLogging mode until all the subscriptions is finished.

So my conclusion is that this.block() is not used in my Meteor.publish call when Meteor.user changes state.

@williamli
Copy link
Author

Initial subscribing of publish with this.unblock: http://d.bbi.io/1hXMo 20+ subscriptions done in 2 seconds

User logout, Meteor seems to be resubscribing: http://d.bbi.io/CLz7 took over 60 seconds...

@williamli williamli changed the title [QUESTION] this.block in publish only work for the first time this.block in publish only work for the first time Dec 9, 2015
@williamli
Copy link
Author

this is an update to my previous issue #7

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

1 participant