From 1007f242002b77db50e004a5a937395fe60f9289 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 16 Sep 2013 22:08:18 -0400 Subject: [PATCH] reduce task allocations by making IBN api synchronous --- MediaBrowser.Api/BaseApiService.cs | 34 ++--- .../DefaultTheme/DefaultThemeService.cs | 35 ++--- MediaBrowser.Api/Images/ImageService.cs | 18 +-- MediaBrowser.Api/InstantMixService.cs | 4 +- MediaBrowser.Api/ItemRefreshService.cs | 16 +-- MediaBrowser.Api/ItemUpdateService.cs | 14 +- .../UserLibrary/ArtistsService.cs | 14 +- .../UserLibrary/BaseItemsByNameService.cs | 5 +- .../UserLibrary/GameGenresService.cs | 14 +- MediaBrowser.Api/UserLibrary/GenresService.cs | 18 +-- .../UserLibrary/ItemByNameUserDataService.cs | 4 +- .../UserLibrary/MusicGenresService.cs | 16 +-- .../UserLibrary/PersonsService.cs | 16 +-- .../UserLibrary/StudiosService.cs | 16 +-- MediaBrowser.Api/UserLibrary/YearsService.cs | 16 +-- MediaBrowser.Controller/Entities/BaseItem.cs | 3 +- MediaBrowser.Controller/Entities/Folder.cs | 10 +- .../Library/ILibraryManager.cs | 37 +++--- .../Dto/DtoService.cs | 92 ++++++------- .../Library/LibraryManager.cs | 121 +++--------------- .../Library/LuceneSearchEngine.cs | 18 +-- .../Library/Validators/ArtistsValidator.cs | 13 +- .../Library/Validators/GameGenresValidator.cs | 10 +- .../Library/Validators/GenresValidator.cs | 8 +- .../Validators/MusicGenresValidator.cs | 8 +- .../Library/Validators/PeoplePostScanTask.cs | 7 +- .../Library/Validators/StudiosValidator.cs | 8 +- 27 files changed, 199 insertions(+), 376 deletions(-) diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.cs index 81c2d43e4f..e969d79ff8 100644 --- a/MediaBrowser.Api/BaseApiService.cs +++ b/MediaBrowser.Api/BaseApiService.cs @@ -95,32 +95,32 @@ namespace MediaBrowser.Api private readonly char[] _dashReplaceChars = new[] { '?', '/' }; private const char SlugChar = '-'; - protected Task GetArtist(string name, ILibraryManager libraryManager) + protected Artist GetArtist(string name, ILibraryManager libraryManager) { return libraryManager.GetArtist(DeSlugArtistName(name, libraryManager)); } - protected Task GetStudio(string name, ILibraryManager libraryManager) + protected Studio GetStudio(string name, ILibraryManager libraryManager) { return libraryManager.GetStudio(DeSlugStudioName(name, libraryManager)); } - protected Task GetGenre(string name, ILibraryManager libraryManager) + protected Genre GetGenre(string name, ILibraryManager libraryManager) { return libraryManager.GetGenre(DeSlugGenreName(name, libraryManager)); } - protected Task GetMusicGenre(string name, ILibraryManager libraryManager) + protected MusicGenre GetMusicGenre(string name, ILibraryManager libraryManager) { return libraryManager.GetMusicGenre(DeSlugGenreName(name, libraryManager)); } - protected Task GetGameGenre(string name, ILibraryManager libraryManager) + protected GameGenre GetGameGenre(string name, ILibraryManager libraryManager) { return libraryManager.GetGameGenre(DeSlugGameGenreName(name, libraryManager)); } - - protected Task GetPerson(string name, ILibraryManager libraryManager) + + protected Person GetPerson(string name, ILibraryManager libraryManager) { return libraryManager.GetPerson(DeSlugPersonName(name, libraryManager)); } @@ -137,7 +137,7 @@ namespace MediaBrowser.Api { return name; } - + return libraryManager.RootFolder.RecursiveChildren .OfType