# Global, Flow and Node Context File Storage Interval

**URL:** <https://discourse.nodered.org/t/global-flow-and-node-context-file-storage-interval/80064>\
**Category:** General\
**Created:** [25 July 2023 15:58 UTC](https://discourse.nodered.org/t/global-flow-and-node-context-file-storage-interval/80064 "2023-07-25T15:58:48Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![davidz](https://avatars.discourse-cdn.com/v4/letter/d/a88e57/32.png) [@davidz](https://discourse.nodered.org/u/davidz)\
**Post date:** [25 July 2023 15:58 UTC](https://discourse.nodered.org/t/global-flow-and-node-context-file-storage-interval/80064/1 "2023-07-25T15:58:48Z")

</div>

If there are global, flow and node context file storage enabled, are the global, flow and node context files saved at the same time, or they are saved at different time?

There is only one context file save interval setting in the "settings.js" file. How does Node-RED handle multiple types of context file storage? Right now, the files are saved at different sub-directories under /context directory.

If the context files are saved at different time, then the probability of getting the context files corrupted increases when the number of context files increases.

This question is related to the context file corruption issue, which causes Node-RED restart failure:

> [@Context File corrupt/truncated - node-red auto-restart failure](https://discourse.nodered.org/t/context-file-corrupt-truncated-node-red-auto-restart-failure/79897):
>
> When my device restarts abruptly - the context file get corrupt because of the truncated json. Automatic restart of node-red fails due to this. One way is to go with a DB based context storage instead of file but MySQL or SQLLite could be little heavyduty for the device sometimes. Have anyone solved this problem using something like untruncate-json or equivalent ? TIA.

We can duplicate this Node-RED restart failure due to context file corruption for the latest Node-RED version 3.0.2.

---

_[View the full topic](https://discourse.nodered.org/t/global-flow-and-node-context-file-storage-interval/80064)._
