Cleanup gree

This commit is contained in:
Ethan O'Brien 2024-04-26 20:34:22 -05:00
parent ab3bcef17f
commit fa1a0946b1

View file

@ -69,24 +69,7 @@ fn lock_and_select(command: &str, args: &[&dyn ToSql]) -> Result<String, rusqlit
} }
} }
fn create_store_v2(table: &str) { fn create_store_v2(table: &str) {
loop { lock_and_exec(table, params!());
match ENGINE.lock() {
Ok(mut result) => {
if result.is_none() {
init(&mut result);
}
let conn = result.as_ref().unwrap();
conn.execute(
table,
(),
).unwrap();
return;
}
Err(_) => {
std::thread::sleep(std::time::Duration::from_millis(15));
}
}
}
} }
fn uuid_exists(uuid: &str) -> bool { fn uuid_exists(uuid: &str) -> bool {
let data = lock_and_select("SELECT uuid FROM uuids WHERE uuid=?1", params!(uuid)); let data = lock_and_select("SELECT uuid FROM uuids WHERE uuid=?1", params!(uuid));
@ -108,7 +91,7 @@ pub fn import_user(uid: i64) -> String {
let token = get_new_uuid(); let token = get_new_uuid();
lock_and_exec( lock_and_exec(
"INSERT INTO users (cert, uuid, user_id) VALUES (?1, ?2, ?3)", "INSERT INTO users (cert, uuid, user_id) VALUES (?1, ?2, ?3)",
params!("", token, uid) params!("none", token, uid)
); );
token token
} }