Iron:router waitOn issues

Hi guys,

Im using Iron:router and meteor-node-csv, after uploading a file i want to read each row of it and insert it on a collection, but when i process the file the whole web freeze (like buttons dont respond). Time ago this same code worked 100% fine, after some upgrade it started working like this.

So, after a lot of testing a partner found that the “waitOn” is a flag here… why ?

If i process the file and try to navigate to a route having a subscription to any other collections it freeze.
If i process the file and try to navigate to a route without a subscription it works perfect

Any idea of this problem ?

I could use some code to understand this better

Something like that:

router.js
Router.route('page1', {
  path: '/page1',
  template: 'page1',
  layoutTemplate: 'layout'
});

Router.route('page2', {
  path: '/page2',
  template: 'page2',
  layoutTemplate: 'layout'
});

Router.route('page3', {
  path: '/page3',
  template: 'page3',
  layoutTemplate: 'layout',
  waitOn: function() {
    return Meteor.subscribe('someCollection');
  }
});
-----------------------------------
page1.js
if (Meteor.isClient) {
  Template.page1.events({
    'click #add': function(event) {
      Meteor.call("function1");
    }
  });
}
-----------------------------------
server-functions.js
Meteor.methods({
	// It take 10/15 secs to complete
 	function1: function() {
            for (var i = 0; i < 1500; i++) {
		Items.insert(something);
	    }
        }
})

We call the “function1” server method in page1. If we try to go to page2 route while the method is in execution, it works succesfully. But if we try to go to page3 route, the system freeze, because this route have “waitOn”.
Thanks!
PD: Sorry my english

@chenroth, @lromanelli is my partner the code he published is the test.

Maybe it’s the fact that DDP messages are handled in order (see Arunoda post on this topic).
Using this.unblock on the Meteor method may solve your problem.

Using this.unblock() gives the same result.

The documentation of unblock:

Call inside a method invocation. Allow subsequent method from this client to begin running in a new fiber.

im becoming crazy with this issue