Node-Red Constantly Disabling on VPS: Seeking Solutions for Continuous Operation

both docker and kubernetes had he exact same code

        const resource = await Config.db.GetResource("Agent Instance", parent);
        let runtime: number = resource?.defaultmetadata?.runtime_hours;
        if (NoderedUtil.IsNullUndefinded(runtime)) {
            // If agent resource does not exists, dont turn off agents
            runtime = 0;
            // If agent resource does exists, but have no default, use 24 hours
            if (!NoderedUtil.IsNullUndefinded(resource)) runtime = 24;
        }

it did not care about multi tenancy … guess my memory is not as good as I though.

If no agent resource has been added, or if the resource’s default metadata does not have runtime_hours it will stop all instances after 24 hours.
If it exists, it turn them off after runtime_hours hours.
That is not what I intended. Not sure how that ended up being like that.

So i have changed it to this in 1.5.9.17 … I will make 1.5.9 the latest version this week.

So now the code is

        const resource: any = await Config.db.GetResource("Agent Instance", parent);
        if (NoderedUtil.IsNullUndefinded(resource)) return;
        let runtime: number = resource?.defaultmetadata?.runtime_hours;
        if (NoderedUtil.IsNullUndefinded(runtime)) {
            // If agent resource does not exists, dont turn off agents
            runtime = 0;
        }
        if (runtime < 1) return;

If no agent resource has been added. Do nothing
If agent resource does not have runtime_hours, do nothing
If runtime_hours exists it will turn off the free plan instances after runtime_hours hours.