flowfuse icon indicating copy to clipboard operation
flowfuse copied to clipboard

Forge app only uses local cache of PlatformSettings data

Open hardillb opened this issue 9 months ago • 2 comments

Current Behavior

When using app.settings.foo = "bar" the API updates the in memory cache then updates the database.

When reading from app.settings.foo it only uses the in memory cache and doesn't refresh from the database.

This will break when we scale the forge app horizontally.

Expected Behavior

Reads from app.settings need to either use a shared cache (redis) or pull from the database on a read.

Steps To Reproduce

Run 2 copies of the forge app with a shared db update admin settings valuses

Environment

  • FlowFuse version: head/main
  • Node.js version: 18.x
  • npm version: 9.x
  • Platform/OS: Kube/Linux
  • Browser: NA

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

hardillb avatar May 13 '24 13:05 hardillb

https://github.com/FlowFuse/flowfuse/blob/main/forge/settings/index.js#L35-L51

hardillb avatar May 13 '24 13:05 hardillb

Generally speaking, reading these settings aren't on hot paths, so can afford to be a db lookup.

knolleary avatar May 13 '24 14:05 knolleary