static async Task Main(string[] args) { if (args.Length < 1) { Console.WriteLine("updbcmd <settings-file-path>"); return; } var settings = UpdbCmdSettings.Load(args[0]); var logger = Logger.Initialize(settings.LogFolderPath, settings.LogFileName); logger.WriteLog(new LogRecord() { Message = string.Format("---- Logging started ----"), }, nameof(Program)); var sw = new Stopwatch(); sw.Start(); await ProcessUpdatePackages(settings); sw.Stop(); logger.WriteLog(new LogRecord() { Message = string.Format("The elapsed time was {0} seconds.", sw.Elapsed.TotalSeconds), }, nameof(Program)); }
private static async Task ProcessUpdatePackages(UpdbCmdSettings settings) { using (var processingItems = new BlockingCollection <ProcessingItem>()) { var itemProducerTaskParam = new ItemProducerTaskParam(processingItems); using (var itemProducer = Task <int> .Factory.StartNew(ItemProducerTaskAction, itemProducerTaskParam, TaskCreationOptions.PreferFairness)) { var workers = new Task <(int Succeeded, int Failed)> [settings.NumOfWorkers];