From 2dcb2f8a9f4be9ca69c050ce9ee94d647e8d5d5f Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Sat, 22 Jan 2022 16:48:31 +0100 Subject: Ban the usage of Task.Result If the calling function can't be made async easily you can still use .GetAwaiter().GetResult(), which is way easier to find in the future --- Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Emby.Server.Implementations/LiveTv') diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 8d0f18d9be..6a9a3077ce 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -915,21 +915,21 @@ namespace Emby.Server.Implementations.LiveTv programs.ToArray()); } - public QueryResult GetRecommendedPrograms(InternalItemsQuery query, DtoOptions options, CancellationToken cancellationToken) + public Task> GetRecommendedProgramsAsync(InternalItemsQuery query, DtoOptions options, CancellationToken cancellationToken) { if (!(query.IsAiring ?? false)) { - return GetPrograms(query, options, cancellationToken).Result; + return GetPrograms(query, options, cancellationToken); } RemoveFields(options); var internalResult = GetRecommendedProgramsInternal(query, options, cancellationToken); - return new QueryResult( + return Task.FromResult(new QueryResult( query.StartIndex, internalResult.TotalRecordCount, - _dtoService.GetBaseItemDtos(internalResult.Items, options, query.User)); + _dtoService.GetBaseItemDtos(internalResult.Items, options, query.User))); } private int GetRecommendationScore(LiveTvProgram program, User user, bool factorChannelWatchCount) -- cgit v1.2.3