You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function storeThingState in ThingManagerImplementation writes every time after a cached thing is changed to the permanent storage.
The destructor destroys the settings object and any changes will be written to permanent storage.
What exactly is the issue here? I suppose this is about the frequent disk I/O?
So this is mainly done in order to deal with power losses as users tend to just cut the power cord on the devices running nymea.
I think there was a branch somewhere which would allow a configuration option to only cache on shutdown, but it never landed at this caused too many issues. I could still see a justification for such a config option though, for systems that cannot easily be unplugged and have more strict I/O limits.
In any case, plugin developers should use the caching feature with caution and disable it for states where caching is not needed. There's probably room for optimization in quite some plugins though. You can enable the ThingManager debug category and it will print a message whenever it caches something. That's useful to find states that are cached but should not be.
When I wrote the issue, I was very deeply involved with the SMA Smart Meter Plugin, which reads data in a high frequency. In the worst case, the file was written 12 times within one second. And we also already have a brocken device where the SD card is damaged.
You are right that here the plugin developer must be very careful.
I think for values that change every second it makes no sense to cache them.
We will check all energy plugins and the hint that we enable the debug category for the ThingManager is very helpful.
The function storeThingState in ThingManagerImplementation writes every time after a cached thing is changed to the permanent storage.
The destructor destroys the settings object and any changes will be written to permanent storage.
The text was updated successfully, but these errors were encountered: