public MirrorAsync ( string id, string version, |
||
id | string | |
version | string | |
token | ||
return | Task |
private async Task ProcessPackagesAsync(string taskName, ConcurrentBag <VsixPackage> packages, ManualResetEventSlim isFullyEnumerated, CancellationToken token) { while (true) { VsixPackage package; if (packages.TryTake(out package)) { var stopwatch = Stopwatch.StartNew(); var pushed = await _mirror.MirrorAsync(package.Id, package.Version, token); if (pushed) { _logger.LogInformationSummary($"[ {taskName} ] VSIX package {package} took {stopwatch.Elapsed.TotalSeconds:0.00} seconds to publish."); } else { _logger.LogInformationSummary($"[ {taskName} ] VSIX package {package} took {stopwatch.Elapsed.TotalSeconds:0.00} seconds to detect no push was necessary."); } _logger.LogInformationSummary($"[ {taskName} ] {packages.Count} VSIX package(s) remain in the queue."); } else { if (isFullyEnumerated.IsSet) { // The concurrent bag is empty and we are done enumerating, so the task // can safely terminate. break; } else { // The enumeration is not done yet, so wait a little bit for more work to // become available. await Task.Delay(TimeSpan.FromMilliseconds(50)); } } } }