Changeset 7b07035 in Klonkt


Ignore:
Timestamp:
07/01/2026 06:18:14 PM (2 months ago)
Author:
roboburr <roboburr@…>
Branches:
main
Children:
dc41bef
Parents:
f1956d7
Message:

chore(db): add busy_timeout + synchronous=NORMAL for concurrent writers

The delivery worker, request handlers and the upcoming background thread-crawler
write concurrently. busy_timeout retries a short write-lock instead of throwing
SQLITE_BUSY; synchronous=NORMAL is safe under WAL and cuts fsyncs.

  • src/config/database.js — busy_timeout=5000, synchronous=NORMAL (alongside WAL).

Co-Authored-By: Claude <noreply@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/config/database.js

    rf1956d7 r7b07035  
    1717db.pragma('journal_mode = WAL');
    1818db.pragma('foreign_keys = ON');
     19// With WAL + several concurrent writers (request handlers, the delivery worker, the
     20// background thread-crawler) a short write-lock should retry rather than throw SQLITE_BUSY.
     21db.pragma('busy_timeout = 5000');   // wait up to 5s for a lock instead of failing immediately
     22db.pragma('synchronous = NORMAL');  // safe with WAL (no torn writes); fewer fsyncs = faster writes
    1923
    2024export function initializeDatabase() {
Note: See TracChangeset for help on using the changeset viewer.