Don't lock database operations to a single thread

This commit is contained in:
Ethan O'Brien
2025-11-30 10:48:16 -06:00
parent b9b344b50c
commit fd47262f52
5 changed files with 80 additions and 98 deletions

View File

@@ -11,11 +11,11 @@ lazy_static! {
static ref CACHED_DATA: Mutex<Option<JsonValue>> = Mutex::new(None);
}
fn setup_tables(conn: &SQLite) {
conn.lock_and_exec("CREATE TABLE IF NOT EXISTS scores (
fn setup_tables(conn: &rusqlite::Connection) {
conn.execute_batch("CREATE TABLE IF NOT EXISTS scores (
event_id INT NOT NULL PRIMARY KEY,
score_data TEXT NOT NULL
)", params!());
);").unwrap();
}
pub fn live_completed(event_id: u32, uid: i64, score: i64, star_level: i64) {