3

In LivedataConnection, line 357, there's a comment that says:

// 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 a client calls a method and gets disconnected before the method returns, it will re-call that message when it reconnects? What if that method isn't idempotent?

1 Answers1

4

Basically, yes, as of version 1.0. Meteor methods are not idempotent. I've reported this issue, as have others, and it's basically confirmed by a core developer:

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

The best way to fix this in most cases is to try and write a unique key to the database, associating with a method request, or to make use of some other clever conditional database updates. There are some discussions about how to do that in these threads:

Community
  • 1
  • 1
Andrew Mao
  • 35,740
  • 23
  • 143
  • 224