private void CleanQueuingUrls()

in code/KustoCopyConsole/Runner/QueueIngestRunner.cs [61:81]


        private void CleanQueuingUrls()
        {
            var allBlocks = RowItemGateway.InMemoryCache.GetActivityFlatHierarchy(
                a => a.RowItem.State != ActivityState.Completed,
                i => i.RowItem.State != IterationState.Completed);
            var queuingBlocks = allBlocks
                .Where(h => h.Block.State == BlockState.Exported)
                .Where(h => h.Urls.Any(u => u.State == UrlState.Queued));
            var queuingUrls = queuingBlocks
                .SelectMany(h => h.Urls);

            foreach (var block in queuingBlocks)
            {
                foreach (var url in block.Urls.Where(u => u.State == UrlState.Queued))
                {
                    var newUrlItem = url.ChangeState(UrlState.Exported);

                    RowItemGateway.Append(newUrlItem);
                }
            }
        }