Global var is persisting between deploy

Hi there, I can't understand if this is a new behaviour. I create a global object var. After deploy it is not being erased.

Setting are default.

27 Jun 15:49:00 - [info] Node-RED version: v4.0.0
27 Jun 15:49:00 - [info] Node.js  version: v20.14.0
27 Jun 15:49:00 - [info] Linux 6.9.3-76060903-generic x64 LE
27 Jun 15:49:01 - [info] Loading palette nodes
27 Jun 15:49:01 - [info] Dashboard version 3.6.5 started at /ui
27 Jun 15:49:01 - [info] Settings file  : /data/settings.js
27 Jun 15:49:01 - [info] Context store  : 'default' [module=memory]

``

It should remain over a deploy because it is in memory and the memory is is still there over a deploy. If you stop/start NR then the variable will be removed.

That makes sense. I thought that it wipe out after a deploy. Any suggestion to clean memory after a deploy?

You can use an inject node, set it to "inject once after 0.1s", add a change node and set the global variable to nothing, or delete it.

Note that this will require your deploy method to be set to modified flows (if it lives on the same flow) or full deploy.

1 Like

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