private async Task <IReadOnlyList <InvalidPackageHash> > PartitionAndProcessAsync( int bucketNumber, int bucketCount, IReadOnlyList <Package> batch, CancellationToken token) { var packages = batch .Select(x => new PackageHash( new PackageIdentity( x.PackageRegistration.Id, NuGetVersion.Parse(x.NormalizedVersion)), x.Hash)) .Where(x => MatchesBucket(bucketNumber, bucketCount, x)) .ToList(); _logger.LogInformation( "{PackageCount} packages are in bucket {BucketNumber}/{BucketCount} from a batch of size {BatchSize}.", packages.Count, bucketNumber, bucketCount, batch.Count); return(await _batchProcessor.ProcessBatchAsync( packages, CoreConstants.Sha512HashAlgorithmId, token)); }