Can Meteor call a method twice on the server if the client disconnects?

In LivedataConnection, line 357 , has a comment, which reads:

// Sends the method message to the server. May be called additional times if
// we lose the connection and reconnect before receiving a result.

      

Does this mean that if the client calls the method and disconnects before the method returns, it will re-call this message on reconnect? What if this method is not idempotent?

+3


source to share


1 answer


Basically, yes, starting with version 1.0. Meteor methods are not idempotent. I have reported this issue as well as others and this is mostly confirmed by the main developer:

https://github.com/meteor/meteor/issues/2407#issuecomment-52375372



The best way to fix this in most cases is to try to write a unique key in the database by linking to the method request or using some other clever conditional database updates. There are several discussions on how to do this in these threads:

+4


source







All Articles