Multiple stores in localfilesystem

I have implemented 2 stores in localfilesystem, in order to better handle my persistent global variables. This is in settings. js:

contextStorage: {
        lilioStore: { module: "localfilesystem"},
        lilioStoreLuci: { module: "localfilesystem"},
        default    : { module: "memory" }
    },

Now, if I watch at the global context in the admin window, I find each variable duplicated, once in each store, with different values!

i.e.:

Schermata 2021-03-01 alle 15.26.41

What is happening?

Each store is a separate store of context data.

When you read/write context, you need to pay attention to which store you are using.

https://nodered.org/docs/user-guide/writing-functions#multiple-context-stores

Yes, of course I am really paying attention, but as you can see from the screenshot, in that view the variables are duplicated. If I look into .node-red/context/global/global.json they are single, not duplicated. Only in that view in the admin page there is this weird list.

If you want two different file stores, you need to make sure you give one of them a different dir or base setting - Local Filesystem Context Store : Node-RED

Otherwise the two stores will share the same location on disk and overwrite each other.

What you are seeing in the sidebar is a result of this.

I will separate the dirs but the weird thing is that currently there is only one instance for each variable in the file. Not in the side view of the admin page.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.