Skip to content

Conversation

alsoba13
Copy link
Contributor

@alsoba13 alsoba13 commented Sep 29, 2025

We have a design problem in pkg/settings/bucket.go

It holds a kind of in in-memory cache of the tenant settings stored in the bucket file tenant_settings.json. BUT that struct is reload before every read or write operation (hence, it doesn't act as a cache), and gets flushed after every write operation (hence we could completely discard after flush).

Problem comes for the logic on Flush. tenant-settings flushes the in-memory version on graceful shutdowns and every 24h. When tenant-settings has not received a single CRUD operation during a release or 24h cycle, the in-memory store is empty then an empty store is flushed.

This causes this very prominent bug, where settings are completely wiped out.
image
(note the 2B files, corresponding to empty json {}).

I could fix this by loading data on start, but still, fail to see any pros of doing such a load and flush. This PR is just a quick win, where we remove the flush from the service lifecycle. I'm not removing the unneeded in-memory cache yet. I think that the extended solution should be through directly using a proper object definition over pkg/settings/store/store.go

@alsoba13 alsoba13 requested a review from a team as a code owner September 29, 2025 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant