fix search index threading (#141)

* fix search index threading

* code cleanup
This commit is contained in:
Jason Dove
2021-04-05 05:41:29 -05:00
committed by GitHub
parent 24cdf6295f
commit 3fb6da0754
29 changed files with 280 additions and 122 deletions
@@ -0,0 +1,17 @@
using System.Threading;
using System.Threading.Tasks;
using ErsatzTV.Core.Interfaces.Search;
using LanguageExt;
namespace ErsatzTV.Application.Search.Commands
{
public class AddItemsToSearchIndexHandler : MediatR.IRequestHandler<AddItemsToSearchIndex, Unit>
{
private readonly ISearchIndex _searchIndex;
public AddItemsToSearchIndexHandler(ISearchIndex searchIndex) => _searchIndex = searchIndex;
public Task<Unit> Handle(AddItemsToSearchIndex request, CancellationToken cancellationToken) =>
_searchIndex.AddItems(request.MediaItems);
}
}