How do I set bufferedWritesInterval, if possible for specific pub/sub

I’ve tried searching for this and not having much luck… sorry if this is clearly posted elsewhere. The best I could do is find this post, but it’s not really clear to me. I searched the commit on github as well… but I’m lost.

Perhaps my issue is not related to this, so here is a brief explanation of the issue I am running into:

I am sorting multiple nested items, which requires multiple collection.update() to be called. At times this fails, on the client I see a glitch where the item is moved back to it’s original position… if I refresh (reload) the order is corrected.

While debugging I have noticed that the helper that builds the hierarchy is called more than once after the update, anywhere from 2-4 times. For some reason the last update at times contains the wrong order information for the document moved, even though the previous one is correct… In other words: if client updates 3 times and I write the output of .find().fetch(), the 1st and 2nd updates has the correct data, but 3rd has incorrect values returned?! (all is written properly to db, just last update is wrong, which is why page reload works).

I am assuming the issue here could be solved by increasing bufferedWritesInterval from 5ms to something slightly higher to ensure the client only updates once and all values are correct?

What I am not understanding is:

  1. Where/how do I set this to a higher value
  2. Other than grater delay, would setting the value to something like 100ms cause any other side-effects? I’ll probably try 20, 40…
  3. Is this a global setting, or can I set it for a specific pub/sub as to not affect the rest of the app.

Any information, pointers, and help would be greatly appreciated – thanks in advance :slight_smile:

client-side its…

Meteor.connection._bufferedWritesInterval = xx; //mSec, default 5, 0 to switch off.

Seems to behave erratically if placed in common code.

Thanks @neurobe I’ve tried this, but don’t really see any changes :unamused:… I’ve tried both in browser console, and in client-side only code. I set absurdly large numbers to make sure there is a great delay, and nothing:

Meteor.connection._bufferedWritesInterval = 3000;
Meteor.connection._bufferedWritesMaxAge = 6000;

Am I correct to assume that this would mean that if multiple updates occur within 3 seconds of each other, they will be batched, and that at a maximum of 6 seconds, buffer will be flushed? So there should be at least a 3 second delay before any client-side updates take place… no?