Throttling Values

I really like the ‘free’ data link of Values, but I haven’t found a convincing way to throttle them - so I only get coalesced updates, less often, similar to other changes.

Any one done this? I can roll a whole cross-thread system, but then I have to store and conserve the values, at which point they become more of a pain than help.


You could write a little intermediary class that connects to one or more values, receiving their change messages, and uses that to trigger an AsyncUpdater, and on its callback makes calls to a set of listeners? Probably not more than 100 lines of code.

That’s about what I have to do. But now I’m also into deciding how to save the value’s current values - quite a few design decisions that I can make, but you tend to make better!

I think I’ll end up saving changes as XML, then processing that at a convenient time… but then I start asking myself why bother with values at all.


Wow, I don’t know what you’re building, but that sounds like a hard way to do it!

I’m open to suggestions…

What I need to do is, on a thread - ideally unblocked, get all the values that changed since the last time I checked (and then get the current value).

I’ve considered an intermediary set of values? Sort of like a subset of values that have changed.

Conversely, I need to take things that have changed and set it back to values, from where it would get to the GUI. I suppose I’ll have to deal with preventing a circular setup.

Hmm, that’s all pretty hairy.

I suppose you could have a single listener that responds to all changes to a ValueTree by pushing info about the change onto a FIFO that your thread could read later…

Uh huh. Something like that.

Just double-checking there’s no shortcut.

But some way of limiting how often value changes come would be useful, for sure. It came up for me sending the values to an external system - the value changes came at a way quicker rate than the device could tolerate.