Skip to content

feat: persistent per-provider key counters#32

Merged
boidushya merged 12 commits into
masterfrom
feat/persistent-counter
Jun 9, 2026
Merged

feat: persistent per-provider key counters#32
boidushya merged 12 commits into
masterfrom
feat/persistent-counter

Conversation

@boidushya

@boidushya boidushya commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

Per-provider counters live in a new counters bucket inside cache.db, updated transactionally with every Set / Delete.
Counter keys are derived from the cache key prefix via a small prefixOf classifier: ttml, kugou, qq, legacy, negative, unknown.
/stats now reads live counts via persistentCache.Counts() in microseconds. New response fields: keys_total, keys_by_provider, last_reconciled_at, last_duration_ms, status (seeding | ready | error), and last_error on failure.
StatsCache was reshaped into a small lifecycle struct. The 24h scan is gone. A weekly background ReconcileCounters corrects drift from rare type-flips (e.g. permanent no-lyrics sentinels stored under provider prefixes).
Clear() wipes the counters bucket in the same transaction as the cache wipe. Restore handler triggers a reconcile so its response reflects the restored DB.

@better-lyrics-harmonizer

better-lyrics-harmonizer Bot commented Jun 9, 2026

Copy link
Copy Markdown

Preview torn down

This PR's ephemeral environment was cleaned up.

Detail Value
Status Torn down
Branch feat/persistent-counter
Last commit fb73cc3
Closed 2026-06-09 13:35:42 UTC
Workflow run #27209938516

Reopen the PR if you need to spin it back up.

@boidushya boidushya merged commit 42f6fff into master Jun 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant