feat: wire main loop with periodic sync+scan and sync_interval config
Replace compute-only run() with an immediate sync+scan followed by a ticker-driven periodic loop, add the sync.interval config field (default 6h) with defaults and validation, and add tests for the scheduling logic.
This commit is contained in:
@@ -58,6 +58,12 @@ func (s *albumSyncer) SyncAlbums(ctx context.Context, db *database.DB) error {
|
||||
return s.syncAlbums(ctx, db)
|
||||
}
|
||||
|
||||
// NewAlbumSyncer adapts the given SyncAlbums function (typically
|
||||
// navidrome.SyncAlbums) into an AlbumSyncer for injection into SyncAll.
|
||||
func NewAlbumSyncer(syncAlbums func(ctx context.Context, db *database.DB) error) AlbumSyncer {
|
||||
return &albumSyncer{syncAlbums: syncAlbums}
|
||||
}
|
||||
|
||||
// SyncAll orchestrates the data pipeline for every monitored artist:
|
||||
// 1. MusicBrainz artist-ID resolution — for each artist with no cached MBID,
|
||||
// resolve it by name and persist it on the artist_settings row. Artists that
|
||||
|
||||
Reference in New Issue
Block a user