Meteor server method gets called multiple times


#1

is it just me or has anyone else noticed before that Meteor.call(“some_method”) will get executed again after some long time if it couldnt finish execution after certain period? i.e. before 1st call of “some_method” has not been finished, 2nd call started automatically after certain period. Any ideas on how to fix that?


#2

Do you have a high-latency between your client and server perhaps?
Meteor methods always kick off at least twice (once on the client and once on the server). I’m not sure if one waits for the other though.


#3

it is a one time method called initiated by the client using Meteor.call() (when user clicks a button) and server processed the large number of data and email after it is done. Before the method call has not even finished execution, it gets called another time by the server and this happens mutiple times like a stack. I was surprised that this was not even mentioned in documentation. Thanks for your reply!


#4

Can you show some code?


#5

This is a known issue and is to do with the Meteor.call timing out and retrying.


#6

Client was calling the method from server without expecting any returns.
eg. Meteor.call(“method_name”);

After i tried to change it to Meteor.call(“method_name”, function(error, response) {});
it seems to be resolved. Given that my server method now returns the value after long execution.
Tested with opened (client is at the page) tab, and closed (client closes the page) tab.