mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-08 02:17:25 +02:00
* feat: make NowPlaying dispatch asynchronous with worker pool Implemented asynchronous NowPlaying dispatch using a queue worker pattern similar to cacheWarmer. Instead of dispatching NowPlaying updates synchronously during the HTTP request, they are now queued and processed by background workers at controlled intervals. Key changes: - Added nowPlayingEntry struct to represent queued entries - Added npQueue map (keyed by playerId), npMu mutex, and npSignal channel to playTracker - Implemented enqueueNowPlaying() to add entries to the queue - Implemented nowPlayingWorker() that polls every 100ms, drains queue, and processes entries - Changed NowPlaying() to queue dispatch instead of calling synchronously - Renamed dispatchNowPlaying() to dispatchNowPlayingAsync() and updated it to use background context Benefits: - HTTP handlers return immediately without waiting for scrobbler responses - Deduplication by key: rapid calls (seeking) only dispatch latest state - Fire-and-forget: one-shot attempts with logged failures - Backpressure-free: worker processes at its own pace - Tests updated to use Eventually() assertions for async dispatch Signed-off-by: Deluan <deluan@navidrome.org> * fix(play_tracker): increase timeout duration for signal handling Signed-off-by: Deluan <deluan@navidrome.org> * refactor(play_tracker): simplify queue processing by directly assigning entries Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org> |
||
|---|---|---|
| .. | ||
| agents | ||
| artwork | ||
| auth | ||
| external | ||
| ffmpeg | ||
| lyrics | ||
| metrics | ||
| playback | ||
| scrobbler | ||
| storage | ||
| archiver.go | ||
| archiver_test.go | ||
| common.go | ||
| common_test.go | ||
| core_suite_test.go | ||
| inspect.go | ||
| library.go | ||
| library_test.go | ||
| maintenance.go | ||
| maintenance_test.go | ||
| media_streamer.go | ||
| media_streamer_Internal_test.go | ||
| media_streamer_test.go | ||
| mock_library_service.go | ||
| players.go | ||
| players_test.go | ||
| playlists.go | ||
| playlists_test.go | ||
| share.go | ||
| share_test.go | ||
| wire_providers.go | ||