mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-11 12:02:35 +02:00
Fixed: Speed Up List Fetch
This commit is contained in:
parent
6802bfc736
commit
62b3ed5d48
@ -14,12 +14,14 @@ public class FetchMovieListModule : RadarrRestModule<MovieResource>
|
||||
{
|
||||
private readonly IFetchNetImport _fetchNetImport;
|
||||
private readonly ISearchForNewMovie _movieSearch;
|
||||
private readonly IProvideMovieInfo _movieInfo;
|
||||
|
||||
public FetchMovieListModule(IFetchNetImport netImport, ISearchForNewMovie movieSearch)
|
||||
public FetchMovieListModule(IFetchNetImport netImport, ISearchForNewMovie movieSearch, IProvideMovieInfo movieInfo)
|
||||
: base("/netimport/movies")
|
||||
{
|
||||
_fetchNetImport = netImport;
|
||||
_movieSearch = movieSearch;
|
||||
_movieInfo = movieInfo;
|
||||
Get("/", x => Search());
|
||||
}
|
||||
|
||||
@ -29,7 +31,11 @@ private object Search()
|
||||
|
||||
List<Movie> realResults = new List<Movie>();
|
||||
|
||||
foreach (var movie in results)
|
||||
var bulkResults = results.Where(r => r.TmdbId != 0);
|
||||
|
||||
bulkResults = _movieInfo.GetBulkMovieInfo(bulkResults.Select(m => m.TmdbId).ToList());
|
||||
|
||||
foreach (var movie in results.Where(r => r.TmdbId == 0))
|
||||
{
|
||||
var mapped = movie;
|
||||
|
||||
@ -44,6 +50,8 @@ private object Search()
|
||||
}
|
||||
}
|
||||
|
||||
realResults.AddRange(bulkResults);
|
||||
|
||||
return MapToResource(realResults);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user