@bobfrankston/mailx-store 0.1.51 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/db.js +7 -1
- package/package.json +1 -1
package/db.js
CHANGED
|
@@ -2661,7 +2661,13 @@ export class MailxDB {
|
|
|
2661
2661
|
// straddling an `await` — the wrapper is nesting-safe (savepoints)
|
|
2662
2662
|
// so it can't collide with the sync backfill's own transactions
|
|
2663
2663
|
// when the two interleave across the yield below.
|
|
2664
|
-
|
|
2664
|
+
// 100, not 500: each chunk is one held write transaction, and the
|
|
2665
|
+
// slow-txn logger caught these running 2+ SECONDS apiece under WAL
|
|
2666
|
+
// pressure — long enough to lock out the sync worker's storeMessages
|
|
2667
|
+
// ("database is locked"). Smaller chunks = shorter lock holds + a
|
|
2668
|
+
// yield (below) after each, giving the worker write windows (Bob
|
|
2669
|
+
// 2026-06-16, live debug).
|
|
2670
|
+
const WRITE_CHUNK = 100;
|
|
2665
2671
|
const entries = [...agg.entries()];
|
|
2666
2672
|
for (let i = 0; i < entries.length; i += WRITE_CHUNK) {
|
|
2667
2673
|
const slice = entries.slice(i, i + WRITE_CHUNK);
|