heartwood every commit a ring

Drop SQLite mmap to avoid multi-process corruption hazard

9cca9dc3 by Isaac Bythewood · 15 days ago

Drop SQLite mmap to avoid multi-process corruption hazard

Gunicorn runs two workers, each with its own SQLite connection. SQLite's
mmap is documented as unsafe for multi-process writers and amplified a
WAL inconsistency into full corruption in the status repo on 2026-04-19.
Removing it defensively here before the same thing happens.
modified analytics/settings/__init__.py
@@ -113,12 +113,16 @@ DATABASES = {        'OPTIONS': {            'timeout': 30,            'transaction_mode': 'IMMEDIATE',            # mmap_size is intentionally omitted: gunicorn workers each open            # their own connection, and SQLite's mmap is documented as unsafe            # for multi-process writers — it amplified an unrelated WAL            # inconsistency into full database corruption in the status repo            # on 2026-04-19.            'init_command': (                'PRAGMA journal_mode=WAL;'                'PRAGMA synchronous=NORMAL;'                'PRAGMA foreign_keys=ON;'                'PRAGMA temp_store=MEMORY;'                'PRAGMA mmap_size=134217728;'                'PRAGMA journal_size_limit=67108864;'                'PRAGMA cache_size=-20000;'            ),