Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throttle property updates in UI #1567

Open
freaktechnik opened this issue Jan 7, 2019 · 4 comments
Open

Throttle property updates in UI #1567

freaktechnik opened this issue Jan 7, 2019 · 4 comments
Labels

Comments

@freaktechnik
Copy link
Contributor

Both my webthing projects have rather high refresh rates on the sensors they expose. That's pretty neat, however the gateway UI has trouble dealing with that. It appears that it tries to re-print all the values every time a single value changes. This leads to it being nearly impossible to change a property from the gateway. It also leads to flicker of the actual property values on the client side, since they are cleared constantly, as the value updates aren't batched in the WoT implementation (and probably the protocol?).

To get reliable operation I have to slow the updates to every couple seconds, depending on the amount of properties that get constant updates. Of course it doesn't make much sense to have a property update every 100ms for binary values, however even a refresh rate of 1 second with 12 properties that are refreshed every second leads to severe flickering, since the properties are updated one after another.

My expectation would be that any property that's not being updated isn't touched and that I can reliably change property values from the gateway while other properties are updating.

@benfrancis
Copy link
Member

Thanks for bringing up this issue. I suggest we should do some kind of throttling so the UI is only updated every second or so, and perhaps improve the rendering of the UI elements.

@benfrancis benfrancis changed the title Fast updating properties Throttle property updates in UI Feb 4, 2019
@rzr
Copy link
Contributor

rzr commented Feb 26, 2019

Thx @freaktechnik for reporting this race condition

I am able to reproduce this with:
https://github.com/rzr/mozilla-iot-generic-sensors-adapter/

So I will slow sensor refresh down from 2Hz to 1Hz

I can also explain how to reproduce without sensors.

@freaktechnik
Copy link
Contributor Author

Based on RzR's issue I'm not sure this is necessarily primarily about speed. It's more about not changing the state of properties that haven't changed in an update. Which is hard to follow, especially for properties that the user can change.

@rzr
Copy link
Contributor

rzr commented Feb 26, 2019

well speed has an effect, to avoid events to cross,

For the record:

<RzR> i think I've found a race condition in notification system
<RzR> UI events could be overridden by non UI updates
<RzR> unsure I am clear, but the effect is like if switch widget is going back to original position just after click
<mrstegeman> yes, that's especially noticeable for slow protocols (like HomeKit)
<RzR> slow of fast ?
<RzR> in sensor I had a refresh rate at 2Hz
<RzR> I am slowing it down to 1
<RzR> if update occurs just after I press the switch off it sets it on and drop the off put
<freaktechnik> oh, that sounds like the "too fast" bug
<freaktechnik> I mean, it has the same issues like https://github.com/mozilla-iot/gateway/issues/1567
<freaktechnik> where some updating properties ruin using non-updating properties
<freaktechnik> (and fast updating properties being unreadable)
<RzR> yea

rzr added a commit to rzr/generic-sensors-webthings that referenced this issue Feb 28, 2019
Bug: WebThingsIO/gateway#1567
Change-Id: Iaca4775ec97bcc8bcbdcf0ae66fab731cea43784
Signed-off-by: Philippe Coval <[email protected]>
rzr added a commit to rzr/generic-sensors-webthings that referenced this issue Feb 28, 2019
Bug: WebThingsIO/gateway#1567
Change-Id: Iaca4775ec97bcc8bcbdcf0ae66fab731cea43784
Signed-off-by: Philippe Coval <[email protected]>
rzr added a commit to rzr/generic-sensors-webthings that referenced this issue Mar 1, 2019
Bug: WebThingsIO/gateway#1567
Change-Id: Iaca4775ec97bcc8bcbdcf0ae66fab731cea43784
Signed-off-by: Philippe Coval <[email protected]>
rzr added a commit to rzr/generic-sensors-webthings that referenced this issue Mar 1, 2019
Bug: WebThingsIO/gateway#1567
Change-Id: Iaca4775ec97bcc8bcbdcf0ae66fab731cea43784
Signed-off-by: Philippe Coval <[email protected]>
@mrstegeman mrstegeman removed the backlog label Apr 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants