@massu/core 2.3.1 → 2.5.0
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/CHANGELOG.md +131 -0
- package/dist/cli.js +175 -41
- package/dist/hooks/auto-learning-pipeline.js +16 -2
- package/dist/hooks/classify-failure.js +13 -2
- package/dist/hooks/cost-tracker.js +13 -2
- package/dist/hooks/fix-detector.js +13 -2
- package/dist/hooks/incident-pipeline.js +13 -2
- package/dist/hooks/intent-suggester.js +13 -2
- package/dist/hooks/memory-recall.js +13 -2
- package/dist/hooks/post-edit-context.js +13 -2
- package/dist/hooks/post-tool-use.js +13 -2
- package/dist/hooks/pre-compact.js +13 -2
- package/dist/hooks/pre-delete-check.js +13 -2
- package/dist/hooks/pre-tool-use-gate.js +13 -2
- package/dist/hooks/quality-event.js +13 -2
- package/dist/hooks/rule-enforcement-pipeline.js +13 -2
- package/dist/hooks/security-gate.js +13 -2
- package/dist/hooks/session-end.js +13 -2
- package/dist/hooks/session-start.js +22 -7
- package/dist/hooks/user-prompt.js +13 -2
- package/package.json +3 -3
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -1193,6 +1193,12 @@ import { join as join2 } from "path";
|
|
|
1193
1193
|
function resolveDbEngine() {
|
|
1194
1194
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
1195
1195
|
}
|
|
1196
|
+
function resolveBusyTimeoutMs() {
|
|
1197
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
1198
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
1199
|
+
const n = Number(raw);
|
|
1200
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
1201
|
+
}
|
|
1196
1202
|
function nodeSqliteCtor() {
|
|
1197
1203
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
1198
1204
|
return _nodeCtor;
|
|
@@ -1214,6 +1220,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
1214
1220
|
enableForeignKeyConstraints: true,
|
|
1215
1221
|
allowExtension: false
|
|
1216
1222
|
});
|
|
1223
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
1217
1224
|
let savepointSeq = 0;
|
|
1218
1225
|
const wrapStmt = (sql) => {
|
|
1219
1226
|
const st = raw.prepare(sql);
|
|
@@ -1297,12 +1304,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
1297
1304
|
return handle;
|
|
1298
1305
|
}
|
|
1299
1306
|
function openBetterSqlite3(dbPath, opts) {
|
|
1300
|
-
|
|
1307
|
+
const db = openDatabase(dbPath, opts);
|
|
1308
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
1309
|
+
return db;
|
|
1301
1310
|
}
|
|
1302
1311
|
function openDatabase2(dbPath, opts = {}) {
|
|
1303
1312
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
1304
1313
|
}
|
|
1305
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
1314
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
1306
1315
|
var init_db_driver = __esm({
|
|
1307
1316
|
"src/db-driver.ts"() {
|
|
1308
1317
|
"use strict";
|
|
@@ -1311,6 +1320,8 @@ var init_db_driver = __esm({
|
|
|
1311
1320
|
req2 = createRequire2(import.meta.url);
|
|
1312
1321
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
1313
1322
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
1323
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
1324
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
1314
1325
|
_nodeCtor = null;
|
|
1315
1326
|
}
|
|
1316
1327
|
});
|
|
@@ -1187,6 +1187,12 @@ import { join as join2 } from "path";
|
|
|
1187
1187
|
function resolveDbEngine() {
|
|
1188
1188
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
1189
1189
|
}
|
|
1190
|
+
function resolveBusyTimeoutMs() {
|
|
1191
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
1192
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
1193
|
+
const n = Number(raw);
|
|
1194
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
1195
|
+
}
|
|
1190
1196
|
function nodeSqliteCtor() {
|
|
1191
1197
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
1192
1198
|
return _nodeCtor;
|
|
@@ -1208,6 +1214,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
1208
1214
|
enableForeignKeyConstraints: true,
|
|
1209
1215
|
allowExtension: false
|
|
1210
1216
|
});
|
|
1217
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
1211
1218
|
let savepointSeq = 0;
|
|
1212
1219
|
const wrapStmt = (sql) => {
|
|
1213
1220
|
const st = raw.prepare(sql);
|
|
@@ -1291,12 +1298,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
1291
1298
|
return handle;
|
|
1292
1299
|
}
|
|
1293
1300
|
function openBetterSqlite3(dbPath, opts) {
|
|
1294
|
-
|
|
1301
|
+
const db = openDatabase(dbPath, opts);
|
|
1302
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
1303
|
+
return db;
|
|
1295
1304
|
}
|
|
1296
1305
|
function openDatabase2(dbPath, opts = {}) {
|
|
1297
1306
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
1298
1307
|
}
|
|
1299
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
1308
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
1300
1309
|
var init_db_driver = __esm({
|
|
1301
1310
|
"src/db-driver.ts"() {
|
|
1302
1311
|
"use strict";
|
|
@@ -1305,6 +1314,8 @@ var init_db_driver = __esm({
|
|
|
1305
1314
|
req2 = createRequire2(import.meta.url);
|
|
1306
1315
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
1307
1316
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
1317
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
1318
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
1308
1319
|
_nodeCtor = null;
|
|
1309
1320
|
}
|
|
1310
1321
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -437,6 +437,12 @@ import { join as join2 } from "path";
|
|
|
437
437
|
function resolveDbEngine() {
|
|
438
438
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
439
439
|
}
|
|
440
|
+
function resolveBusyTimeoutMs() {
|
|
441
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
442
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
443
|
+
const n = Number(raw);
|
|
444
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
445
|
+
}
|
|
440
446
|
function nodeSqliteCtor() {
|
|
441
447
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
442
448
|
return _nodeCtor;
|
|
@@ -458,6 +464,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
458
464
|
enableForeignKeyConstraints: true,
|
|
459
465
|
allowExtension: false
|
|
460
466
|
});
|
|
467
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
461
468
|
let savepointSeq = 0;
|
|
462
469
|
const wrapStmt = (sql) => {
|
|
463
470
|
const st = raw.prepare(sql);
|
|
@@ -541,12 +548,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
541
548
|
return handle;
|
|
542
549
|
}
|
|
543
550
|
function openBetterSqlite3(dbPath, opts) {
|
|
544
|
-
|
|
551
|
+
const db = openDatabase(dbPath, opts);
|
|
552
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
553
|
+
return db;
|
|
545
554
|
}
|
|
546
555
|
function openDatabase2(dbPath, opts = {}) {
|
|
547
556
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
548
557
|
}
|
|
549
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
558
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
550
559
|
var init_db_driver = __esm({
|
|
551
560
|
"src/db-driver.ts"() {
|
|
552
561
|
"use strict";
|
|
@@ -555,6 +564,8 @@ var init_db_driver = __esm({
|
|
|
555
564
|
req2 = createRequire2(import.meta.url);
|
|
556
565
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
557
566
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
567
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
568
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
558
569
|
_nodeCtor = null;
|
|
559
570
|
}
|
|
560
571
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -1187,6 +1187,12 @@ import { join as join2 } from "path";
|
|
|
1187
1187
|
function resolveDbEngine() {
|
|
1188
1188
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
1189
1189
|
}
|
|
1190
|
+
function resolveBusyTimeoutMs() {
|
|
1191
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
1192
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
1193
|
+
const n = Number(raw);
|
|
1194
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
1195
|
+
}
|
|
1190
1196
|
function nodeSqliteCtor() {
|
|
1191
1197
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
1192
1198
|
return _nodeCtor;
|
|
@@ -1208,6 +1214,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
1208
1214
|
enableForeignKeyConstraints: true,
|
|
1209
1215
|
allowExtension: false
|
|
1210
1216
|
});
|
|
1217
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
1211
1218
|
let savepointSeq = 0;
|
|
1212
1219
|
const wrapStmt = (sql) => {
|
|
1213
1220
|
const st = raw.prepare(sql);
|
|
@@ -1291,12 +1298,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
1291
1298
|
return handle;
|
|
1292
1299
|
}
|
|
1293
1300
|
function openBetterSqlite3(dbPath, opts) {
|
|
1294
|
-
|
|
1301
|
+
const db = openDatabase(dbPath, opts);
|
|
1302
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
1303
|
+
return db;
|
|
1295
1304
|
}
|
|
1296
1305
|
function openDatabase2(dbPath, opts = {}) {
|
|
1297
1306
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
1298
1307
|
}
|
|
1299
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
1308
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
1300
1309
|
var init_db_driver = __esm({
|
|
1301
1310
|
"src/db-driver.ts"() {
|
|
1302
1311
|
"use strict";
|
|
@@ -1305,6 +1314,8 @@ var init_db_driver = __esm({
|
|
|
1305
1314
|
req2 = createRequire2(import.meta.url);
|
|
1306
1315
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
1307
1316
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
1317
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
1318
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
1308
1319
|
_nodeCtor = null;
|
|
1309
1320
|
}
|
|
1310
1321
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|
|
@@ -431,6 +431,12 @@ import { join as join2 } from "path";
|
|
|
431
431
|
function resolveDbEngine() {
|
|
432
432
|
return process.env[DB_ENGINE_ENV] === "better-sqlite3" ? "better-sqlite3" : DEFAULT_DB_ENGINE;
|
|
433
433
|
}
|
|
434
|
+
function resolveBusyTimeoutMs() {
|
|
435
|
+
const raw = process.env[DB_BUSY_TIMEOUT_ENV];
|
|
436
|
+
if (raw === void 0 || raw === "") return DEFAULT_BUSY_TIMEOUT_MS;
|
|
437
|
+
const n = Number(raw);
|
|
438
|
+
return Number.isFinite(n) && n >= 0 ? Math.floor(n) : DEFAULT_BUSY_TIMEOUT_MS;
|
|
439
|
+
}
|
|
434
440
|
function nodeSqliteCtor() {
|
|
435
441
|
if (!_nodeCtor) _nodeCtor = req2("node:sqlite").DatabaseSync;
|
|
436
442
|
return _nodeCtor;
|
|
@@ -452,6 +458,7 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
452
458
|
enableForeignKeyConstraints: true,
|
|
453
459
|
allowExtension: false
|
|
454
460
|
});
|
|
461
|
+
raw.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
455
462
|
let savepointSeq = 0;
|
|
456
463
|
const wrapStmt = (sql) => {
|
|
457
464
|
const st = raw.prepare(sql);
|
|
@@ -535,12 +542,14 @@ function openNodeSqlite(dbPath, opts) {
|
|
|
535
542
|
return handle;
|
|
536
543
|
}
|
|
537
544
|
function openBetterSqlite3(dbPath, opts) {
|
|
538
|
-
|
|
545
|
+
const db = openDatabase(dbPath, opts);
|
|
546
|
+
db.exec(`PRAGMA busy_timeout = ${resolveBusyTimeoutMs()}`);
|
|
547
|
+
return db;
|
|
539
548
|
}
|
|
540
549
|
function openDatabase2(dbPath, opts = {}) {
|
|
541
550
|
return resolveDbEngine() === "better-sqlite3" ? openBetterSqlite3(dbPath, opts) : openNodeSqlite(dbPath, opts);
|
|
542
551
|
}
|
|
543
|
-
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, _nodeCtor;
|
|
552
|
+
var req2, DEFAULT_DB_ENGINE, DB_ENGINE_ENV, DEFAULT_BUSY_TIMEOUT_MS, DB_BUSY_TIMEOUT_ENV, _nodeCtor;
|
|
544
553
|
var init_db_driver = __esm({
|
|
545
554
|
"src/db-driver.ts"() {
|
|
546
555
|
"use strict";
|
|
@@ -549,6 +558,8 @@ var init_db_driver = __esm({
|
|
|
549
558
|
req2 = createRequire2(import.meta.url);
|
|
550
559
|
DEFAULT_DB_ENGINE = "node-sqlite";
|
|
551
560
|
DB_ENGINE_ENV = "MASSU_DB_ENGINE";
|
|
561
|
+
DEFAULT_BUSY_TIMEOUT_MS = 5e3;
|
|
562
|
+
DB_BUSY_TIMEOUT_ENV = "MASSU_DB_BUSY_TIMEOUT_MS";
|
|
552
563
|
_nodeCtor = null;
|
|
553
564
|
}
|
|
554
565
|
});
|