remove unneeded async signatures

This commit is contained in:
Luke Pulverenti
2017-10-03 14:39:37 -04:00
parent a7b0b601fa
commit a5b82cd2ec
32 changed files with 231 additions and 338 deletions

View File

@@ -738,8 +738,7 @@ namespace Emby.Server.Implementations.Library
if (folder.ParentId != rootFolder.Id)
{
folder.ParentId = rootFolder.Id;
var task = folder.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
Task.WaitAll(task);
folder.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
}
rootFolder.AddVirtualChild(folder);
@@ -1834,12 +1833,12 @@ namespace Emby.Server.Implementations.Library
/// <param name="updateReason">The update reason.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
public async Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken)
public void UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken)
{
var locationType = item.LocationType;
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
{
await _providerManagerFactory().SaveMetadata(item, updateReason).ConfigureAwait(false);
_providerManagerFactory().SaveMetadata(item, updateReason);
}
item.DateLastSaved = DateTime.UtcNow;
@@ -2053,7 +2052,7 @@ namespace Emby.Server.Implementations.Library
return GetNamedView(user, name, null, viewType, sortName, cancellationToken);
}
public async Task<UserView> GetNamedView(string name,
public UserView GetNamedView(string name,
string viewType,
string sortName,
CancellationToken cancellationToken)
@@ -2100,7 +2099,7 @@ namespace Emby.Server.Implementations.Library
if (refresh)
{
await item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None).ConfigureAwait(false);
item.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
_providerManagerFactory().QueueRefresh(item.Id, new MetadataRefreshOptions(_fileSystem)
{
// Not sure why this is necessary but need to figure it out
@@ -2241,7 +2240,7 @@ namespace Emby.Server.Implementations.Library
return item;
}
public async Task<UserView> GetNamedView(string name,
public UserView GetNamedView(string name,
string parentId,
string viewType,
string sortName,
@@ -2294,7 +2293,7 @@ namespace Emby.Server.Implementations.Library
if (!string.Equals(viewType, item.ViewType, StringComparison.OrdinalIgnoreCase))
{
item.ViewType = viewType;
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken).ConfigureAwait(false);
item.UpdateToRepository(ItemUpdateType.MetadataEdit, cancellationToken);
}
var refresh = isNew || DateTime.UtcNow - item.DateLastRefreshed >= _viewRefreshInterval;
@@ -2822,7 +2821,7 @@ namespace Emby.Server.Implementations.Library
await _providerManagerFactory().SaveImage(item, url, image.Type, imageIndex, CancellationToken.None).ConfigureAwait(false);
await item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false);
item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
return item.GetImageInfo(image.Type, imageIndex);
}
@@ -2838,7 +2837,7 @@ namespace Emby.Server.Implementations.Library
// Remove this image to prevent it from retrying over and over
item.RemoveImage(image);
await item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None).ConfigureAwait(false);
item.UpdateToRepository(ItemUpdateType.ImageUpdate, CancellationToken.None);
throw new InvalidOperationException();
}

View File

@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.Library
{
cancellationToken.ThrowIfCancellationRequested();
await AssignTrailers(item, trailers).ConfigureAwait(false);
AssignTrailers(item, trailers);
numComplete++;
double percent = numComplete;
@@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.Library
progress.Report(100);
}
private async Task AssignTrailers(IHasTrailers item, IEnumerable<BaseItem> channelTrailers)
private void AssignTrailers(IHasTrailers item, IEnumerable<BaseItem> channelTrailers)
{
if (item is Game)
{
@@ -98,8 +98,7 @@ namespace Emby.Server.Implementations.Library
item.RemoteTrailerIds = trailerIds;
var baseItem = (BaseItem)item;
await baseItem.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None)
.ConfigureAwait(false);
baseItem.UpdateToRepository(ItemUpdateType.MetadataImport, CancellationToken.None);
}
}
}

View File

@@ -147,7 +147,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
Items = videos
};
var isInMixedFolder = resolverResult.Count > 1;
var isInMixedFolder = resolverResult.Count > 1 || (parent != null && parent.IsTopParent);
foreach (var video in resolverResult)
{

View File

@@ -102,7 +102,7 @@ namespace Emby.Server.Implementations.Library
if (_config.Configuration.EnableFolderView)
{
var name = _localizationManager.GetLocalizedString("ViewType" + CollectionType.Folders);
list.Add(await _libraryManager.GetNamedView(name, CollectionType.Folders, string.Empty, cancellationToken).ConfigureAwait(false));
list.Add(_libraryManager.GetNamedView(name, CollectionType.Folders, string.Empty, cancellationToken));
}
if (query.IncludeExternalContent)
@@ -117,7 +117,7 @@ namespace Emby.Server.Implementations.Library
if (_config.Configuration.EnableChannelView && channels.Length > 0)
{
list.Add(await _channelManager.GetInternalChannelFolder(cancellationToken).ConfigureAwait(false));
list.Add(_channelManager.GetInternalChannelFolder(cancellationToken));
}
else
{
@@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.Library
if (_liveTvManager.GetEnabledUsers().Select(i => i.Id.ToString("N")).Contains(query.UserId))
{
list.Add(await _liveTvManager.GetInternalLiveTvFolder(CancellationToken.None).ConfigureAwait(false));
list.Add(_liveTvManager.GetInternalLiveTvFolder(CancellationToken.None));
}
}
@@ -158,14 +158,14 @@ namespace Emby.Server.Implementations.Library
.ToArray();
}
public Task<UserView> GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken)
public UserView GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken)
{
var uniqueId = parentId + "subview" + type;
return _libraryManager.GetNamedView(name, parentId, type, sortName, uniqueId, cancellationToken);
}
public Task<UserView> GetUserSubView(string parentId, string type, string sortName, CancellationToken cancellationToken)
public UserView GetUserSubView(string parentId, string type, string sortName, CancellationToken cancellationToken)
{
var name = _localizationManager.GetLocalizedString("ViewType" + type);