Data storage (guild-configs.json)

Local JSON persistence with low I/O and safe writes.

Storage model

We use a local JSON file: guild-configs.json.

Primary goal: efficient I/O.

Required state keys

At minimum, store:

  • config[guildId].lastUserId

  • the current count (or next expected count)

Keep the object flat and small.

I/O rules

  • Avoid synchronous disk writes inside hot paths.

  • Batch or debounce writes when possible.

  • Write only when state changes.

Why: disk churn can spike CPU under constrained hosts.

Last updated