feat: complete task 6 - fix stale notification pruning to avoid SQLite parameter limit
This commit is contained in:
@@ -63,18 +63,17 @@ Problem: Three separate filter implementations (`musicbrainz.FilterReleaseGroups
|
||||
- [x] Run tests - must pass before task 5
|
||||
|
||||
### Task 5: Fix ArtistCacheFresh lexicographic time comparison
|
||||
- [ ] Change `external_releases.cached_at` from TEXT to INTEGER (unix epoch seconds) via migration `006_cached_at_to_integer`
|
||||
- [ ] Update `FormatCachedAt` to return `time.Time.Unix()` (int64)
|
||||
- [ ] Update `ArtistCacheFresh` query to compare `cached_at >= ?` as integers
|
||||
- [ ] Update `SaveExternalRelease` and sync insert to store integer timestamp
|
||||
- [ ] Write tests: verify cache freshness check works across format change; test migration on existing DB
|
||||
- [ ] Run tests - must pass before task 6
|
||||
- [x] Change `external_releases.cached_at` from TEXT to INTEGER (unix epoch seconds) via migration `010_cached_at_to_integer`
|
||||
- [x] Update `FormatCachedAt` to return `time.Time.Unix()` (int64)
|
||||
- [x] Update `ArtistCacheFresh` query to compare `cached_at >= ?` as integers
|
||||
- [x] Update `SaveExternalRelease` and sync insert to store integer timestamp
|
||||
- [x] Write tests: verify cache freshness check works across format change; test migration on existing DB
|
||||
- [x] Run tests - must pass before task 6
|
||||
|
||||
### Task 6: Batch stale notification pruning to avoid SQLite parameter limit
|
||||
- [ ] Modify stale notification deletion in `sync.go` (lines 150-185) to process in chunks of 500 parameters
|
||||
- [ ] Or rewrite using CTE: `DELETE FROM notifications_sent WHERE rgid IN (SELECT rgid FROM external_releases WHERE artist_id = ? AND rgid NOT IN (SELECT rgid FROM external_releases WHERE artist_id = ? AND rgid IN (...)))` — but CTE still needs placeholders. Safer: batch loop over `synced` slice in chunks of 900.
|
||||
- [ ] Write test with >1000 synthetic release groups to verify no parameter-limit error
|
||||
- [ ] Run tests - must pass before task 7
|
||||
- [x] Modify stale notification deletion in `sync.go` (lines 150-185) to process in chunks of 500 parameters
|
||||
- [x] Write test with >1000 synthetic release groups to verify no parameter-limit error
|
||||
- [x] Run tests - must pass before task 7
|
||||
|
||||
### Task 7: Handle ErrArtistNotFound in ScanArtist gracefully
|
||||
- [ ] In `ScanArtist`, wrap `GetArtistSettings` call; if `ErrArtistNotFound`, use empty `TypeFilter` (no filtering) instead of returning error
|
||||
|
||||
Reference in New Issue
Block a user