meteorhacks/unblock

this.block in publish only work for the first time

Opened this issue · 2 comments

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.

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...

this is an update to my previous issue #7