Move Away From Peewee (Database is locked error)

Peewee does not support concurrent reads/writes. When we try to read or write concurrently with peewee users will experience a "db is locked" error. This renders crafty almost useless. Users cannot start or stop servers because we utilize the queue of commands inside crafty's DB.

Shutting down servers while stopping Crafty still works so users will not experience a hard stop of servers as long as they gracefully shutdown Crafty.

The solution to this bug would be to move away from Peewee to an ORM that supports some sort of queuing for DB requests. Sqlite in and of itself does not support concurrency, but we can find an ORM that will give us the illusion of concurrency by utilizing caching and queuing.

Another suggestion was to move away from sqlite entirely. There are some pros and cons with this suggestion:

Pros:

  • Expanded scalability for Crafty
  • Would solve DB locked bug

Cons:

  • Increased burden on users who would need to learn how to spin up a SQL server along with Crafty.
  • Would then remove the ease of use of Crafty where someone can spin it up and have a server running so quickly.
  • More support cases.
  • Would possibly have to force all users to docker (WE DO NOT WANT THIS)
Edited by Andrew