Recently Saved Module Script Lost If Hub Loses Power
-
I've got a Flic Hub LR on firmware 4.6.0. I've noticed if I reboot the hub within a couple minutes after saving a module file I've just edited that the file can be completely empty or incomplete after the reboot.
But, if I reboot 10min or more after saving, the files are intact. I haven't noticed the same issue with a module's
datastore.dbcontents which seem to stay intact even when edited shortly before the reboot.Is there some delay before a saved script file is flushed to storage?
-
@Emil thanks for the info.
I do mean power cycling by unplugging and replugging.
Would it be possible to add some way to force an immediate sync (maybe upon disconnect from Hub Studio if that doesn't sync already, I usually just leave the web page with it still connected)? Or to do a graceful reboot with a button in Hub Studio or via Flic app which syncs properly?
I was doing reboot in connection with my testing on the Thread issue that I posted about. It seems sometimes I can bring the Thread connection back by rebooting Flic Hub.
-
With reboot, you mean abruptly unplug the power and insert it again?
Yes, this is handled by the Linux kernel, which buffers writes for some time. By buffering writes, wear on the flash is reduced, which has a limited number of write / erase cycles.
Using the data store module, data is safe however since fsync is used. A journal is also used for pending writes. We believe the data consistency of such data is important to be tolerant from power outages.