(root: string, metas: NoteMeta[])
| 1836 | } |
| 1837 | |
| 1838 | function schedulePersistNoteMetaCache(root: string, metas: NoteMeta[]): void { |
| 1839 | if (process.env.ZEN_PERF_DISABLE_PERSISTED_META_CACHE === '1') return |
| 1840 | const rootAbs = path.resolve(root) |
| 1841 | clearScheduledPersistNoteMetaCache(rootAbs) |
| 1842 | |
| 1843 | const timer = setTimeout(() => { |
| 1844 | noteMetaCachePersistTimers.delete(rootAbs) |
| 1845 | const entries = snapshotNoteMetaCache(root, metas) |
| 1846 | if (entries.length === 0) return |
| 1847 | void persistNoteMetaCacheSnapshot(root, entries) |
| 1848 | }, 1000) |
| 1849 | if (typeof timer === 'object' && 'unref' in timer) timer.unref() |
| 1850 | noteMetaCachePersistTimers.set(rootAbs, timer) |
| 1851 | } |
| 1852 | |
| 1853 | function clearScheduledPersistNoteMetaCache(rootAbs: string): void { |
| 1854 | const existing = noteMetaCachePersistTimers.get(rootAbs) |
no test coverage detected