NEUTRINO render cache: cache hits don't refresh age; stale work-* folders never cleaned

Aperta
#43 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
TypeScript
Stelle
3
Fork
0
Merge medio
2h 17m
PR unite (30g)
39

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di receptron/jinglescript

Tutte le issue di receptron/jinglescript

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.