From cf1428d678bb64cd8ac03698184572f5ea90ab34 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Wed, 4 Feb 2026 19:17:48 -0500 Subject: [PATCH] Fix manual mapping race condition and add log gitignore --- .gitignore | 3 +++ allstarr/Controllers/AdminController.cs | 21 +++++++++------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 1652d08..505113f 100644 --- a/.gitignore +++ b/.gitignore @@ -88,6 +88,9 @@ apis/*.md apis/*.json !apis/jellyfin-openapi-stable.json +# Log files for debugging +apis/*.log + # Endpoint usage tracking apis/endpoint-usage.json /app/cache/endpoint-usage/ diff --git a/allstarr/Controllers/AdminController.cs b/allstarr/Controllers/AdminController.cs index a4ad081..b0ceceb 100644 --- a/allstarr/Controllers/AdminController.cs +++ b/allstarr/Controllers/AdminController.cs @@ -841,19 +841,16 @@ public class AdminController : ControllerBase { _logger.LogInformation("Triggering immediate playlist rebuild for {Playlist} with new manual mapping", decodedName); - // Run in background so we don't block the response - _ = Task.Run(async () => + // Wait for the rebuild to complete before responding to ensure UI gets updated cache + try { - try - { - await _matchingService.TriggerMatchingForPlaylistAsync(decodedName); - _logger.LogInformation("✓ Playlist {Playlist} rebuilt successfully with manual mapping", decodedName); - } - catch (Exception ex) - { - _logger.LogError(ex, "Failed to rebuild playlist {Playlist} after manual mapping", decodedName); - } - }); + await _matchingService.TriggerMatchingForPlaylistAsync(decodedName); + _logger.LogInformation("✓ Playlist {Playlist} rebuilt successfully with manual mapping", decodedName); + } + catch (Exception ex) + { + _logger.LogError(ex, "Failed to rebuild playlist {Playlist} after manual mapping", decodedName); + } } else {