binusgdc / VCPA

A Discord bot that records voice call participants' attendance
2 stars 4 forks source link

Use a better database #19

Open 500-internal-server-error opened 1 year ago

500-internal-server-error commented 1 year ago

Currently, the bot uses a plain array to store session data. This makes the sessions "database" ephemeral and prone to disruptions (e.g., if the bot crashses while in the middle of a session, that session data is lost, as if the session was never started).

One solution would be to make use of sqlite as a more permanent database, allowing sessions to be resumed should they be interrupted for whatever reason. While it has never happened before as of the writing of this issue, it is a good precaution to take.

istamarahsan commented 1 year ago

sqlite might be too overkill for such a scenario. Since the current implementation is just an in-memory key-value store, why not swap it out for an embedded one like RocksDB? levelup is an NPM package for interfacing with KV stores including RocksDB.

500-internal-server-error commented 1 year ago

An alternative database is fine, as long as it's persistent, i.e., session data is not lost should the bot crash / be shut down for whatever reason.

istamarahsan commented 1 year ago

Right, then I'll get started on this find someone to assign this to.

istamarahsan commented 12 months ago

Use a Redis db as a buffer for completed sessions.

alfonsusac commented 5 months ago

Gw saranin langsung pake Prisma + Supabase/Neon aja