mirror of
https://github.com/collinbarrett/FilterLists.git
synced 2026-03-11 09:04:27 +00:00
don't eat perf cost of exceptions for not supported extensions
This commit is contained in:
parent
dda7de8ef1
commit
fb69ce76e0
1 changed files with 26 additions and 34 deletions
|
|
@ -30,30 +30,30 @@ private static readonly Dictionary<string, Func<ListInfo, IRequest>> DownloadReq
|
|||
= new Dictionary<string, Func<ListInfo, IRequest>>
|
||||
{
|
||||
{"", l => new DownloadTxt.Command(l)},
|
||||
{".7z", l => throw new NotImplementedException()},
|
||||
{".acl", l => throw new NotImplementedException()},
|
||||
{".action", l => throw new NotImplementedException()},
|
||||
{".all", l => throw new NotImplementedException()},
|
||||
{".aspx", l => throw new NotImplementedException()},
|
||||
{".bat", l => throw new NotImplementedException()},
|
||||
{".blacklist", l => throw new NotImplementedException()},
|
||||
{".conf", l => throw new NotImplementedException()},
|
||||
{".csv", l => throw new NotImplementedException()},
|
||||
{".dat", l => throw new NotImplementedException()},
|
||||
{".deny", l => throw new NotImplementedException()},
|
||||
{".host", l => throw new NotImplementedException()},
|
||||
{".hosts", l => throw new NotImplementedException()},
|
||||
{".ips", l => throw new NotImplementedException()},
|
||||
{".ipset", l => throw new NotImplementedException()},
|
||||
{".json", l => throw new NotImplementedException()},
|
||||
{".list", l => throw new NotImplementedException()},
|
||||
{".lsrules", l => throw new NotImplementedException()},
|
||||
{".netset", l => throw new NotImplementedException()},
|
||||
{".p2p", l => throw new NotImplementedException()},
|
||||
{".php", l => throw new NotImplementedException()},
|
||||
{".tpl", l => throw new NotImplementedException()},
|
||||
{".txt", l => new DownloadTxt.Command(l)},
|
||||
{".zip", l => throw new NotImplementedException()}
|
||||
//{".7z", l => throw new NotImplementedException()},
|
||||
//{".acl", l => throw new NotImplementedException()},
|
||||
//{".action", l => throw new NotImplementedException()},
|
||||
//{".all", l => throw new NotImplementedException()},
|
||||
//{".aspx", l => throw new NotImplementedException()},
|
||||
//{".bat", l => throw new NotImplementedException()},
|
||||
//{".blacklist", l => throw new NotImplementedException()},
|
||||
//{".conf", l => throw new NotImplementedException()},
|
||||
//{".csv", l => throw new NotImplementedException()},
|
||||
//{".dat", l => throw new NotImplementedException()},
|
||||
//{".deny", l => throw new NotImplementedException()},
|
||||
//{".host", l => throw new NotImplementedException()},
|
||||
//{".hosts", l => throw new NotImplementedException()},
|
||||
//{".ips", l => throw new NotImplementedException()},
|
||||
//{".ipset", l => throw new NotImplementedException()},
|
||||
//{".json", l => throw new NotImplementedException()},
|
||||
//{".list", l => throw new NotImplementedException()},
|
||||
//{".lsrules", l => throw new NotImplementedException()},
|
||||
//{".netset", l => throw new NotImplementedException()},
|
||||
//{".p2p", l => throw new NotImplementedException()},
|
||||
//{".php", l => throw new NotImplementedException()},
|
||||
//{".tpl", l => throw new NotImplementedException()},
|
||||
{".txt", l => new DownloadTxt.Command(l)}
|
||||
//{".zip", l => throw new NotImplementedException()}
|
||||
};
|
||||
|
||||
private readonly ILogger<Handler> _logger;
|
||||
|
|
@ -67,15 +67,7 @@ public Handler(ILogger<Handler> logger, IMediator mediator)
|
|||
|
||||
protected override async Task Handle(Command request, CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
await DownloadByFileExtension(request, cancellationToken);
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
_logger.LogWarning(
|
||||
$"File extension not supported for list {request.ListInfo.Id} from {request.ListInfo.ViewUrl}.");
|
||||
}
|
||||
await DownloadByFileExtension(request, cancellationToken);
|
||||
}
|
||||
|
||||
private async Task DownloadByFileExtension(Command request, CancellationToken cancellationToken)
|
||||
|
|
@ -91,7 +83,7 @@ await _mediator.Send(DownloadRequestsByFileExtension[extension].Invoke(request.L
|
|||
else
|
||||
{
|
||||
_logger.LogWarning(
|
||||
$"File extension not recognized for list {request.ListInfo.Id} from {request.ListInfo.ViewUrl}.");
|
||||
$"File extension not supported for list {request.ListInfo.Id} from {request.ListInfo.ViewUrl}.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue