Skip to content

Commit 5caefdf

Browse files
committed
Fixes to tagMentionCache max age being 24x too old
1 parent f9b72e9 commit 5caefdf

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎jgclark.Dashboard/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ For more details see the [plugin's documentation](https://noteplan.co/plugins/jg
55

66
## [2.6.0.b10] 2026-11-05
77
- Fix: Clicking a task row (or its note title) while a search or refresh is still running now opens the note when that work finishes. The click used to be dropped, so nothing opened.
8+
- Fix: Rebuild against tagMentionCache from np.Shared v1.3.3 which fixes a full regeneration happening far too infrequently.
89

910
## [2.6.0.b9] 2026-11-04
1011
- Fix: "Explain selected item filters" no longer implies a generated item will be visible when `filterPriorityItems` is on. Summary now says GENERATE vs DISPLAY, and warns that React may hide lower-priority rows behind "lower-priority items currently hidden".

‎np.Shared/CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ See [Shared Plugin's README](https://noteplan.co/plugins/np.Shared) for details
44

55
## [1.3.3] 2026-11-04
66
- Fix: incremental tag/mention cache update counted days with `previous.diff(now)`, which is negative. `getNotesChangedInInterval` then started after the current time, found no changed notes, and still moved `lastUpdated` forward, so later edits never entered the cache until a full rebuild.
7+
- Fix: a full tag/mention cache rebuild was scheduled only after `5 * 24 * 24` hours (120 days), rather than just `5 * 24` hours (5 days).
78

89
## [1.3.2] 2026-10-28
910
- Fix: tag/mention cache generate/update now scans notes via `runSyncWorkOnAsyncThread(..., { items, batchSize })` (helpers/NPThreads) -- short async-thread batches with a main-thread breather between them -- instead of one long `runOnAsyncThread` call. Mitigates stuck "Generating tag/mention cache" progress when the async Promise never settles after many `TNote` bridge reads (NotePlan/plugins#793). Progress dialog updates every 20 notes (and after each batch).

‎np.Shared/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"plugin.script": "script.js",
1515
"plugin.url": "https://noteplan.co/plugins/np.Shared",
1616
"plugin.changelog": "https://github.com/NotePlan/plugins/blob/main/np.Shared/CHANGELOG.md",
17-
"plugin.lastUpdateInfo": "1.3.3: Fix: Incremental update now looks back far enough to include notes changed since the last run.\n1.3.2: Fix: tag/mention cache rebuild uses short runOnAsyncThread batches (to avoid stuck 'Generating tag/mention cache progress' messages from API weakness).",
17+
"plugin.lastUpdateInfo": "1.3.3: Fix: Incremental update now looks back far enough to include notes changed since the last run. Full tag/mention cache rebuild is scheduled after 5 days, not 120.\n1.3.2: Fix: tag/mention cache rebuild uses short runOnAsyncThread batches (to avoid stuck 'Generating tag/mention cache progress' messages from API weakness).",
1818
"plugin.requiredFiles": [
1919
"apple-switch.css",
2020
"css.w3.css",

‎np.Shared/src/tagMentionCache.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//-----------------------------------------------------------------------------
33
// Shared tag/mention cache for any plugin (owned by np.Shared)
44
// Written originally by @jgclark for Dashboard plugin.
5-
// last updated 2026-10-28 for v1.3.3 by @jgclark + @CursorAI
5+
// last updated 2026-11-05 for v1.3.3 by @jgclark + @CursorAI
66
//-----------------------------------------------------------------------------
77
// Cache body (`tagMentionCache.json`):
88
// {
@@ -539,14 +539,14 @@ export function isTagMentionCacheGenerationScheduled(): boolean {
539539
}
540540

541541
/**
542-
* Schedule a regeneration of the tag mention cache if it's too old (>24 hours). Note: assumes that the cache is available.
542+
* Schedule a regeneration of the tag mention cache if it's too old (>= TAG_CACHE_GENERATE_INTERVAL_HOURS, 5 days). Note: assumes that the cache is available.
543543
* @param {string} generatedAtStr The date and time the cache was generated.
544544
*/
545545
export function scheduleTagMentionCacheGenerationIfTooOld(generatedAtStr: string): void {
546546
const nowMom = moment()
547547
const generatedAtMom = moment(generatedAtStr)
548548
const diffHours = nowMom.diff(generatedAtMom, 'hours', true).toFixed(3) // 3 significant figures
549-
if (diffHours >= (TAG_CACHE_GENERATE_INTERVAL_HOURS * 24)) {
549+
if (diffHours >= TAG_CACHE_GENERATE_INTERVAL_HOURS) {
550550
logInfo('scheduleTagMentionCacheGenerationIfTooOld', `Tag mention cache is too old (${diffHours}hours), so scheduling a regeneration.`)
551551
scheduleTagMentionCacheGeneration()
552552
} else {
@@ -1160,7 +1160,7 @@ export function getTagMentionCacheDiagnosticsLines(): Array<string> {
11601160
lines.push('### Settings')
11611161
lines.push(`- TAG_CACHE_ONLY_FOR_OPEN_ITEMS (code): ${String(TAG_CACHE_ONLY_FOR_OPEN_ITEMS)}`)
11621162
lines.push(`- Update interval: ${String(TAG_CACHE_UPDATE_INTERVAL_HOURS)} hour(s)`)
1163-
lines.push(`- Full regenerate interval: ${String(TAG_CACHE_GENERATE_INTERVAL_HOURS)} day(s)`)
1163+
lines.push(`- Full regenerate interval: ${String(TAG_CACHE_GENERATE_INTERVAL_HOURS)} hour(s)`)
11641164
lines.push(`- Regeneration scheduled (pref): ${String(generationScheduled)}`)
11651165
lines.push(`- Last run: ${lastRunPref != null ? String(lastRunPref) : '(not set)'} (from pref)`)
11661166
lines.push(`- Cache files: ${tagMentionCacheFile}`)

0 commit comments

Comments
 (0)