jetlej
jetlej

Reputation: 3392

How to make Meteor changes instant?

Meteor is supposed to pre-load a small part of Mongo client-side so that it can simulate changes to the DB. Thus making any changes to the page happen instantly while the real DB update happens in the background.

However, on my site I'm seeing a 1-2 second delay on simple actions that make changes to the DB, such as deleting a post.

Is there some extra coding that needs to be done to ensure the client-side simulation works?

Upvotes: 0

Views: 35

Answers (2)

Ricardo Pesciotta
Ricardo Pesciotta

Reputation: 393

If you are using server-side method only, make sure your Mongodb has oplog tailing enabled, so that the change is picked up immediately and sent to the client. If you are using like a hosted db, like the free mlab, it's possible you have no oplog, the meteor falls back to querying the db periodically to check for changes. But in any case, if the method is server side only, you will always have delays. Like mentioned in this thread, move the method definition outside the server folder (like /lib) só that the method becomes available on th client.

Upvotes: 1

Winston RIley
Winston RIley

Reputation: 482

As Michel Floyd Pointed out, if your meteor method is defined as server only code, there is no way to simulate the method call on the client.

Try moving Meteor method declarations into shared code, and see if that changes latency time.

also, without seeing some code and project structure the problem could be else where...

Upvotes: 1

Related Questions