From 937d27ae9d6aa571ab9327f138bfba1b84c158db Mon Sep 17 00:00:00 2001 From: LukePulverenti Luke Pulverenti luke pulverenti Date: Sun, 19 Aug 2012 16:38:31 -0400 Subject: One async call leads to another, and another, all the way up the call stack... --- MediaBrowser.Api/HttpHandlers/PluginsHandler.cs | 34 ++++++++++++++----------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'MediaBrowser.Api/HttpHandlers/PluginsHandler.cs') diff --git a/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs b/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs index c3c1b4049..f451832dd 100644 --- a/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs +++ b/MediaBrowser.Api/HttpHandlers/PluginsHandler.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using MediaBrowser.Common.Net.Handlers; using MediaBrowser.Controller; using MediaBrowser.Model.DTO; @@ -11,26 +12,29 @@ namespace MediaBrowser.Api.HttpHandlers /// public class PluginsHandler : BaseJsonHandler> { - protected override IEnumerable GetObjectToSerialize() + protected override Task> GetObjectToSerialize() { - var plugins = Kernel.Instance.Plugins.Select(p => + return Task.Run(() => { - return new PluginInfo() + var plugins = Kernel.Instance.Plugins.Select(p => { - Path = p.Path, - Name = p.Name, - Enabled = p.Enabled, - DownloadToUI = p.DownloadToUI, - Version = p.Version - }; - }); + return new PluginInfo() + { + Path = p.Path, + Name = p.Name, + Enabled = p.Enabled, + DownloadToUI = p.DownloadToUI, + Version = p.Version + }; + }); - if (QueryString["uionly"] == "1") - { - plugins = plugins.Where(p => p.DownloadToUI); - } + if (QueryString["uionly"] == "1") + { + plugins = plugins.Where(p => p.DownloadToUI); + } - return plugins; + return plugins; + }); } } } -- cgit v1.2.3