refactor(api): use async/await in MovieController.AllMovie (#107)

Convert blocking GetAwaiter().GetResult() to proper await pattern
in the API controller method.

Partial fix for #32

Co-authored-by: admin <admin@ardentleatherworks.com>
This commit is contained in:
Cody Kickertz 2025-12-21 14:00:03 -06:00 committed by GitHub
parent b413c390fd
commit b124fd8fc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -114,7 +114,7 @@ public MovieController(IBroadcastSignalRMessage signalRBroadcaster,
}
[HttpGet]
public List<MovieResource> AllMovie(int? tmdbId, bool excludeLocalCovers = false, int? languageId = null)
public async Task<List<MovieResource>> AllMovie(int? tmdbId, bool excludeLocalCovers = false, int? languageId = null)
{
var moviesResources = new List<MovieResource>();
@ -144,7 +144,7 @@ public List<MovieResource> AllMovie(int? tmdbId, bool excludeLocalCovers = false
var tdict = translations.ToDictionaryIgnoreDuplicates(x => x.MovieMetadataId);
var sdict = movieStats.ToDictionary(x => x.MovieId);
var movies = movieTask.GetAwaiter().GetResult();
var movies = await movieTask;
moviesResources = new List<MovieResource>(movies.Count);