|
2 | 2 | //----------------------------------------------------------------------------- |
3 | 3 | // Shared tag/mention cache for any plugin (owned by np.Shared) |
4 | 4 | // 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 |
6 | 6 | //----------------------------------------------------------------------------- |
7 | 7 | // Cache body (`tagMentionCache.json`): |
8 | 8 | // { |
@@ -539,14 +539,14 @@ export function isTagMentionCacheGenerationScheduled(): boolean { |
539 | 539 | } |
540 | 540 |
|
541 | 541 | /** |
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. |
543 | 543 | * @param {string} generatedAtStr The date and time the cache was generated. |
544 | 544 | */ |
545 | 545 | export function scheduleTagMentionCacheGenerationIfTooOld(generatedAtStr: string): void { |
546 | 546 | const nowMom = moment() |
547 | 547 | const generatedAtMom = moment(generatedAtStr) |
548 | 548 | 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) { |
550 | 550 | logInfo('scheduleTagMentionCacheGenerationIfTooOld', `Tag mention cache is too old (${diffHours}hours), so scheduling a regeneration.`) |
551 | 551 | scheduleTagMentionCacheGeneration() |
552 | 552 | } else { |
@@ -1160,7 +1160,7 @@ export function getTagMentionCacheDiagnosticsLines(): Array<string> { |
1160 | 1160 | lines.push('### Settings') |
1161 | 1161 | lines.push(`- TAG_CACHE_ONLY_FOR_OPEN_ITEMS (code): ${String(TAG_CACHE_ONLY_FOR_OPEN_ITEMS)}`) |
1162 | 1162 | 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)`) |
1164 | 1164 | lines.push(`- Regeneration scheduled (pref): ${String(generationScheduled)}`) |
1165 | 1165 | lines.push(`- Last run: ${lastRunPref != null ? String(lastRunPref) : '(not set)'} (from pref)`) |
1166 | 1166 | lines.push(`- Cache files: ${tagMentionCacheFile}`) |
|
0 commit comments