feat(activity): add SQLite PRAGMA and connection pool config #339

Merged
fuzzy merged 1 commit from feat/289-sqlite-pragmas into main 2026-07-08 05:06:10 +00:00
Owner

What

Configure SQLite on Cache.Open() with standard embedded SQLite best practices:

  • PRAGMA journal_mode=WAL — concurrent read/write performance
  • PRAGMA foreign_keys=ON — referential integrity
  • db.SetMaxOpenConns(1) — prevent SQLITE_BUSY from concurrent writes

Why

The cache previously used SQLite defaults which lack WAL journaling and foreign key enforcement. A single concurrent writer connection prevents locking errors in an embedded context.

Testing

  • go build passes
  • go test -race -short ./... passes (all cache tests exercise the new configuration)
  • golangci-lint passes

Closes #289

## What Configure SQLite on `Cache.Open()` with standard embedded SQLite best practices: - `PRAGMA journal_mode=WAL` — concurrent read/write performance - `PRAGMA foreign_keys=ON` — referential integrity - `db.SetMaxOpenConns(1)` — prevent SQLITE_BUSY from concurrent writes ## Why The cache previously used SQLite defaults which lack WAL journaling and foreign key enforcement. A single concurrent writer connection prevents locking errors in an embedded context. ## Testing - [x] `go build` passes - [x] `go test -race -short ./...` passes (all cache tests exercise the new configuration) - [x] golangci-lint passes Closes #289
feat(activity): add SQLite PRAGMA and connection pool config
All checks were successful
Test and Release / lint (pull_request) Successful in 27s
Test and Release / test (pull_request) Successful in 41s
89f1c07c55
- Set journal_mode=WAL for concurrent read/write performance
- Enable foreign_keys for referential integrity
- Set MaxOpenConns(1) to prevent SQLITE_BUSY from concurrent writes
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-08 05:05:52 +00:00
the.auditor left a comment

Review

Result: Approved — no issues. Closes #289.

13 lines adding PRAGMA journal_mode=WAL, PRAGMA foreign_keys=ON, and db.SetMaxOpenConns(1) to Cache.Open(). Applied after ping, before migration. Errors handled — closes DB and returns wrapped error. Clean.

## Review **Result: Approved** — no issues. Closes #289. 13 lines adding `PRAGMA journal_mode=WAL`, `PRAGMA foreign_keys=ON`, and `db.SetMaxOpenConns(1)` to `Cache.Open()`. Applied after ping, before migration. Errors handled — closes DB and returns wrapped error. Clean.
fuzzy merged commit 89f1c07c55 into main 2026-07-08 05:06:10 +00:00
fuzzy deleted branch feat/289-sqlite-pragmas 2026-07-08 05:06:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/steeper!339
No description provided.