contextData on fileSystem

Post Reply
bytex
Posts: 2
Joined: 25 Oct 2022, 10:35
Answers: 0

contextData on fileSystem

Post 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?
User avatar
nicolaiB
KUNBUS
Posts: 869
Joined: 21 Jun 2018, 10:33
Answers: 7
Location: Berlin
Contact:

Re: contextData on fileSystem

Post 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
bytex
Posts: 2
Joined: 25 Oct 2022, 10:35
Answers: 0

Re: contextData on fileSystem

Post by bytex »

Thanks a lot, I did not know this feature.
Resolved.
Post Reply