Back to Blog
July 18, 20269 min read
SQLite WAL Mode inside Electron Subprocesses
SQLite databases are highly efficient for local-first desktop apps. However, because cold email enrichment involves concurrently executing multiple scraper threads in the background, a standard SQLite file can hit database lock errors.
To address this inside Electron, we enabled Write-Ahead Logging (WAL) mode:
PRAGMA journal_mode = WAL;
PRAGMA synchronous = NORMAL;
PRAGMA synchronous = NORMAL;
In WAL mode, instead of locking the database for every single scraped contact write, changes are written to a log file separate from the database (`.wal`). Multiple reader threads can continue querying lists, contacts, and SMTP parameters with zero lock delays, which are periodically checkpointed back to the primary `.db` file in idle states.