Context
LiteQueue forces these settings on the write connection:
PRAGMA journal_mode = WAL;
PRAGMA temp_store = MEMORY;
PRAGMA synchronous = NORMAL;
The recent commits correctly stopped overriding SQLite's cache size. The durability part of the backlog remains open: callers cannot request synchronous=FULL through the LiteQueue API.
In WAL mode, NORMAL protects database consistency but can lose recently committed transactions after an operating-system crash or power loss. This may be the right performance tradeoff for many queues, but persistent task queues also have use cases where the latest commit must survive power loss.
Why implement this
Durability is part of the queue's data-loss contract. The library should make the tradeoff explicit instead of choosing it silently. A small policy is easier to support safely than accepting arbitrary PRAGMA text.
Proposed direction
- Add a narrow constructor option such as
durability="normal" | "full".
- Validate it before opening or mutating the database.
- Apply the matching synchronous setting to the write connection.
- Keep
normal as the default if preserving current performance is important.
- Document application-crash, OS-crash, and power-loss behavior for each mode.
- Query and test the effective PRAGMA value.
Acceptance criteria
Context
LiteQueue forces these settings on the write connection:
The recent commits correctly stopped overriding SQLite's cache size. The durability part of the backlog remains open: callers cannot request
synchronous=FULLthrough the LiteQueue API.In WAL mode,
NORMALprotects database consistency but can lose recently committed transactions after an operating-system crash or power loss. This may be the right performance tradeoff for many queues, but persistent task queues also have use cases where the latest commit must survive power loss.Why implement this
Durability is part of the queue's data-loss contract. The library should make the tradeoff explicit instead of choosing it silently. A small policy is easier to support safely than accepting arbitrary PRAGMA text.
Proposed direction
durability="normal" | "full".normalas the default if preserving current performance is important.Acceptance criteria
journal_modeandsynchronousvalues.make testpasses.