Giter Site home page Giter Site logo

Comments (9)

mitar avatar mitar commented on June 15, 2024 1

I think a new issue would be better instead of commenting on and old one.

But this is a great catch! No, this was not expected. I have copied this from the client side code, which does not have this restriction. Maybe open an issue in reactive-mongo package and we can work through it there?

from meteor-reactive-publish.

mitar avatar mitar commented on June 15, 2024

This sounds like something connected with polling instead of oplog? Polling is every 10 seconds? Do you have oplog enabled on production?

Can you share some code?

Also, rerunning on userId change is something done already. Do you need to use autorun?

from meteor-reactive-publish.

dpatte avatar dpatte commented on June 15, 2024

I suspected polling but i have been told that my deployed system is actually using oplog.

Changing userId changes the list of users whose data I want to publish. I actually then publish more detailed data about each user, as well as their docs.

from meteor-reactive-publish.

mitar avatar mitar commented on June 15, 2024

Can you show some code?

from meteor-reactive-publish.

dpatte avatar dpatte commented on June 15, 2024

It turns out that the deployed system is using polling after all. So, yes it has to do with polling.
I have also discovered that it also only occurs on pages that have Router.onBeforeAction(requireLoginRt, .....
I'm now beginning to think it is a router issue, or a conflict between iron router and reactive publish, or related to polling's lazy comparison of record changes.

from meteor-reactive-publish.

mitar avatar mitar commented on June 15, 2024

Can you create a small reproduction?

from meteor-reactive-publish.

dpatte avatar dpatte commented on June 15, 2024

Actually, I removed the autorun, and I still have the issue. I guess the problem is somewhere else. Thanks for putting up with my questions.

from meteor-reactive-publish.

etyp avatar etyp commented on June 15, 2024

@mitar I'm a bit confused here - it seems like any find done within an autorun (excluding the cursor which is returned) uses the polling observe driver.

For example, if I have:

Meteor.publish('messagesForGroup', function (groupId) {
  this.autorun(() => {
    const group = Groups.findOne(groupId, { fields: { members: 1 } });
    if (group.members.indexOf(this.userId) > -1) {
      return Messages.find({ group: group._id });
    }
  });
});

It seems like the findOne Groups.findOne(groupId, { fields: { members: 1 } }); uses polling instead of oplog.

Is that expected?

from meteor-reactive-publish.

etyp avatar etyp commented on June 15, 2024

From what I can tell, the reactive-mongo package adds addedBefore and movedBefore callbacks to fetch, map and forEach on cursors.

Because of this, it fails the first check in observeChanges in Meteor's mongo_driver.js for whether or not it can use oplog.

The presence of addedBefore and movedBefore means that ordered returns true when the driver calls LocalCollection._observeChangesCallbacksAreOrdered.

Was it ever intended for finds inside of server-side autoruns to use oplog or are they always expected to fall back on polling?

from meteor-reactive-publish.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.