Page 1 of 1

contextData on fileSystem

Posted: 25 Oct 2022, 10:51
by bytex
I have variables saved on context fileSystem.
https://nodered.org/docs/user-guide/context

I notice that if I restart the RevPi (sudo reboot) the variables are kept.
Conversely, if the device is turned off by removing the power supply, the variables are not maintained.

How can you overcome this problem?

Re: contextData on fileSystem

Posted: 25 Oct 2022, 11:11
by nicolaiB
Hi,

this is probably caused by the fact, that the context is not written to the storage. When the RevPi is being shutdown / rebooted NodeRed stops gracefully and writes everything to the disk. If you just powercycle the device NodeRed has no chance of writing the context to the disk.

From the NodeRed docs https://nodered.org/docs/api/context/st ... filesystem:
The flushInterval is provided to minimise wear on the underlying storage, such as on a Raspberry Pi’s SD card. Note that if Node-RED is unexpectedly killed, any data that has not yet been flushed will be lost.
Nicolai

Re: contextData on fileSystem

Posted: 25 Oct 2022, 13:45
by bytex
Thanks a lot, I did not know this feature.
Resolved.