How to use pollingThrottle and pollingInterval?

北战南征 提交于 2019-12-06 12:03:26

Those 10sec should be 10 ms.

  1. Be sure that you are only updating MongoDB and not Minimongo - for example, if you update through Meteor methods, be sure you don't have client stubs.

  2. Try this:

    Meteor.publish("currentRoom", function (roomName) {
      return Rooms.find({name: roomName}, {
        disableOplog: true,
        pollingThrottleMs: 10000, 
        pollingIntervalMs: 10000
      });
    });
    

You have to disable oplog tailing. If you don't, you still get notified every time the MongoDB logs change.

I tested this with an observer on the client and it worked.

Cursor.observe({
  changed: (newdoc, olddoc) => {
    console.log('changed');
  }
});

Additional info:

https://github.com/meteor/docs/blob/version-NEXT/long-form/oplog-observe-driver.md http://info.meteor.com/blog/tuning-meteor-mongo-livedata-for-scalability

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!