small tidies

This commit is contained in:
Collin M. Barrett 2019-06-28 19:53:33 -05:00
parent e193b20442
commit 89848926bf

View file

@ -22,7 +22,7 @@ public Command(IEnumerable<ListInfo> listInfo)
public class Handler : AsyncRequestHandler<Command>
{
private const int MaxDegreeOfParallelism = 20; //TODO: tune
private const int MaxDegreeOfParallelism = 5; //TODO: tune
private readonly IMediator _mediator;
public Handler(IMediator mediator)
@ -47,10 +47,10 @@ protected override async Task Handle(Command request, CancellationToken cancella
private static IEnumerable<ListInfo> ShardByHost(IEnumerable<ListInfo> listInfo)
{
return listInfo.GroupBy(l => l.ViewUrl.Host)
.SelectMany((g, gi) => g.Select((l, li) => new {Index = li, GroupIndex = gi, Value = l}))
.OrderBy(u => u.Index)
.ThenBy(u => u.GroupIndex)
.Select(u => u.Value);
.SelectMany((g, gi) => g.Select((l, li) => new {Index = li, GroupIndex = gi, ListInfo = l}))
.OrderBy(a => a.Index)
.ThenBy(a => a.GroupIndex)
.Select(a => a.ListInfo);
}
}
}