Compare commits

...

2 Commits

Author SHA1 Message Date
spinline
2e36c28c0d fix(frontend): replace unwrap() with expect() for better error messages
All checks were successful
Build MIPS Binary / build (push) Successful in 4m13s
- console_log::init_with_level() now uses expect()
- web_sys::window() now uses expect() with helpful message
- window.document() now uses expect()
- document.body() now uses expect()

This provides meaningful error messages if WASM initialization fails.
2026-02-08 05:41:07 +03:00
spinline
6530e20af2 perf(db): enable SQLite WAL mode and performance settings
All checks were successful
Build MIPS Binary / build (push) Successful in 4m14s
- PRAGMA journal_mode=WAL - concurrent reads while writing
- PRAGMA synchronous=NORMAL - faster than FULL, still safe
- PRAGMA busy_timeout=5000 - reduces database locked errors

Note: Existing databases should be deleted to enable WAL mode properly.
2026-02-08 05:34:06 +03:00
2 changed files with 23 additions and 4 deletions

View File

@@ -21,6 +21,21 @@ impl Db {
}
async fn run_migrations(&self) -> Result<()> {
// WAL mode - enables concurrent reads while writing
sqlx::query("PRAGMA journal_mode=WAL")
.execute(&self.pool)
.await?;
// NORMAL synchronous - faster than FULL, still safe enough
sqlx::query("PRAGMA synchronous=NORMAL")
.execute(&self.pool)
.await?;
// 5 second busy timeout - reduces "database locked" errors
sqlx::query("PRAGMA busy_timeout=5000")
.execute(&self.pool)
.await?;
sqlx::migrate!("./migrations").run(&self.pool).await?;
Ok(())
}

View File

@@ -11,11 +11,15 @@ use app::App;
#[wasm_bindgen(start)]
pub fn main() {
console_error_panic_hook::set_once();
console_log::init_with_level(log::Level::Debug).unwrap();
console_log::init_with_level(log::Level::Debug)
.expect("Failed to initialize logging");
let window = web_sys::window().unwrap();
let document = window.document().unwrap();
let body = document.body().unwrap();
let window = web_sys::window()
.expect("Failed to access window - browser may not be fully loaded");
let document = window.document()
.expect("Failed to access document");
let body = document.body()
.expect("Failed to access document body");
// Add app-loaded class to body to hide spinner via CSS
let _ = body.class_list().add_1("app-loaded");