exe-watcher 0.2.9 → 0.2.11
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/dist/cli.js +20 -6
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -6760,6 +6760,7 @@ function nextLocalMidnight(dateString) {
|
|
|
6760
6760
|
}
|
|
6761
6761
|
function computeProgressiveBackfillStart({
|
|
6762
6762
|
lastComputedDate,
|
|
6763
|
+
oldestCachedDate,
|
|
6763
6764
|
todayStart,
|
|
6764
6765
|
yesterdayEnd,
|
|
6765
6766
|
backfillDays,
|
|
@@ -6767,14 +6768,23 @@ function computeProgressiveBackfillStart({
|
|
|
6767
6768
|
progressiveChunkDays = DEFAULT_PROGRESSIVE_CHUNK_DAYS
|
|
6768
6769
|
}) {
|
|
6769
6770
|
const fullBackfillStart = new Date(todayStart.getTime() - backfillDays * MS_PER_DAY3);
|
|
6771
|
+
const neededStart = new Date(todayStart.getTime() - (coldStartHistoryDays - 1) * MS_PER_DAY3);
|
|
6770
6772
|
if (!lastComputedDate) {
|
|
6771
6773
|
const priorHistoryDays = Math.max(coldStartHistoryDays - 1, 0);
|
|
6772
6774
|
return new Date(todayStart.getTime() - priorHistoryDays * MS_PER_DAY3);
|
|
6773
6775
|
}
|
|
6774
6776
|
const gapStart = nextLocalMidnight(lastComputedDate);
|
|
6775
|
-
if (gapStart
|
|
6776
|
-
|
|
6777
|
-
|
|
6777
|
+
if (gapStart.getTime() <= yesterdayEnd.getTime()) {
|
|
6778
|
+
if (gapStart < fullBackfillStart) return fullBackfillStart;
|
|
6779
|
+
if (yesterdayEnd.getTime() - gapStart.getTime() > progressiveChunkDays * MS_PER_DAY3) {
|
|
6780
|
+
return new Date(yesterdayEnd.getTime() - progressiveChunkDays * MS_PER_DAY3);
|
|
6781
|
+
}
|
|
6782
|
+
return gapStart;
|
|
6783
|
+
}
|
|
6784
|
+
if (oldestCachedDate && neededStart.getTime() < new Date(oldestCachedDate).getTime()) {
|
|
6785
|
+
const backTarget = new Date(oldestCachedDate);
|
|
6786
|
+
const chunkStart = new Date(backTarget.getTime() - progressiveChunkDays * MS_PER_DAY3);
|
|
6787
|
+
return chunkStart < neededStart ? neededStart : chunkStart;
|
|
6778
6788
|
}
|
|
6779
6789
|
return gapStart;
|
|
6780
6790
|
}
|
|
@@ -7078,18 +7088,22 @@ program.command("status").description("Compact status output (today + week + mon
|
|
|
7078
7088
|
const latestFresh = freshDays.length > 0 ? freshDays[freshDays.length - 1].date : null;
|
|
7079
7089
|
c = { ...c, days: freshDays, lastComputedDate: latestFresh };
|
|
7080
7090
|
}
|
|
7091
|
+
const oldestCachedDate = c.days.length > 0 ? c.days[0].date : null;
|
|
7081
7092
|
const effectiveGapStart = computeProgressiveBackfillStart({
|
|
7082
7093
|
lastComputedDate: c.lastComputedDate,
|
|
7094
|
+
oldestCachedDate,
|
|
7083
7095
|
todayStart,
|
|
7084
7096
|
yesterdayEnd,
|
|
7085
7097
|
backfillDays: BACKFILL_DAYS,
|
|
7086
7098
|
coldStartHistoryDays: selectedPeriodHistoryDays
|
|
7087
7099
|
});
|
|
7088
|
-
|
|
7089
|
-
|
|
7100
|
+
const gapEnd = oldestCachedDate && effectiveGapStart.getTime() < new Date(oldestCachedDate).getTime() ? new Date(new Date(oldestCachedDate).getTime() - MS_PER_DAY4) : yesterdayEnd;
|
|
7101
|
+
if (effectiveGapStart.getTime() <= gapEnd.getTime()) {
|
|
7102
|
+
const gapRange = { start: effectiveGapStart, end: gapEnd };
|
|
7090
7103
|
const gapProjects = filterProjectsByName(await parseAllSessions(gapRange, "all"), opts.project, opts.exclude);
|
|
7091
7104
|
const gapDays = fillMissingDays(gapRange.start, gapRange.end, aggregateProjectsIntoDays(gapProjects));
|
|
7092
|
-
|
|
7105
|
+
const coveredThrough = gapEnd.getTime() >= yesterdayEnd.getTime() ? yesterdayStr : void 0;
|
|
7106
|
+
c = addNewDays(c, gapDays, yesterdayStr, coveredThrough ? { coveredThrough } : void 0);
|
|
7093
7107
|
await saveDailyCache(c);
|
|
7094
7108
|
}
|
|
7095
7109
|
return c;
|