getaimeter 0.6.2 → 0.6.3
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/package.json +1 -1
- package/watcher.js +12 -4
package/package.json
CHANGED
package/watcher.js
CHANGED
|
@@ -372,10 +372,18 @@ function extractCursorUsage(dbPath) {
|
|
|
372
372
|
if (!findSqlite3()) return [];
|
|
373
373
|
if (!fs.existsSync(dbPath)) return [];
|
|
374
374
|
|
|
375
|
-
// Check if the DB
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const
|
|
375
|
+
// Check if the DB has been modified since our last check.
|
|
376
|
+
// SQLite WAL mode: writes go to dbPath-wal, not the main file.
|
|
377
|
+
// We check the WAL file's mtime (if it exists) since that's what changes.
|
|
378
|
+
const walPath = dbPath + '-wal';
|
|
379
|
+
let currentMtime;
|
|
380
|
+
try {
|
|
381
|
+
if (fs.existsSync(walPath)) {
|
|
382
|
+
currentMtime = fs.statSync(walPath).mtimeMs;
|
|
383
|
+
} else {
|
|
384
|
+
currentMtime = fs.statSync(dbPath).mtimeMs;
|
|
385
|
+
}
|
|
386
|
+
} catch { return []; }
|
|
379
387
|
const lastMtime = getOffset(dbPath + ':mtime');
|
|
380
388
|
if (currentMtime <= lastMtime) return [];
|
|
381
389
|
|