NEUTRINO render cache: cache hits don't refresh age; stale work-* folders never cleaned
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- backend
Research direction
Start with pruneRenders and neutrinoWav in src/singer/neutrino.ts, then read the existing pruneRenders tests. Check how cache hits are handled and how render work directories are named and cleaned up. Add tests for refreshing a cached WAV's mtime and removing stale work-* folders while keeping fresh ones; done means both behaviors pass.
Written by the indexing model from the issue text.
Description
Follow-up from the review of #42. pruneRenders (src/singer/neutrino.ts) trims ~/.cache/jinglescript/neutrino-renders/ before each uncached NEUTRINO render. It has two gaps.
1. Cache hits don't refresh a render's age, so the most-used renders are dropped.
neutrinoWav returns a cached WAV with readFileSync, which leaves its mtime unchanged. pruneRenders sorts and expires by mtime, so "oldest" means "created longest ago", not "used longest ago". A render used every day is still deleted after 30 days, or as soon as 200 newer ones exist, and the next render runs NEUTRINO again (tens of seconds).
Fix: on a cache hit, touch the file (utimesSync(file, now, now)) so the 30-day / 200-file limits act as least-recently-used.
2. Leftover work-* folders are never cleaned up.
Each render works in neutrino-renders/work-XXXX/ and removes it in finally. If the process is killed or crashes mid-render, or NEUTRINO_KEEP_WORK=1 was set, the folder stays. pruneRenders only looks at *.wav, so these folders (labels, f0, mel, wav: several MB each) build up forever. One was left in my own cache after the review.
Fix: also remove work-* directories older than some age (e.g. 1 day, so a render running in another process isn't touched).
Tests: extend the pruneRenders tests with a hit that refreshes the mtime, and a stale work-* folder that gets removed while a fresh one is kept.
- Dominant language
- TypeScript
- Stars
- 3
- Forks
- 0
- Avg merge
- 2h 17m
- Merged PRs (30d)
- 39
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from receptron/jinglescript
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
receptron/jinglescript#48 ·
Maintainers usually reply within 1 day
All issues in receptron/jinglescript
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Maintainers usually reply within 2 days
-
BeOS .json missingOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mihaip/infinite-mac#475 ·
-
Let TypeScript accept an initial object in ReactiveDictPossibly taken @yograj-vijay-yadav claimed this today. Openbug good first issue help wanted workshop
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
meteor/meteor#14919 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
marmelab/atomic-crm#401 ·
Maintainers usually reply within 1 day
-
account: profile
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 5 days