protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { var keys = LoadSearchKeys(); foreach (var searchKey in LoadSearchKeys()) { var collect = _dataSearcherService.Collect(searchKey.Trim()).Result; if (collect != null && collect.Count > 0) { //_outputGenerator.Create(collect,searchKey).Save(); var pdf = _outputGenerator.Create(collect, searchKey).Pdf(); if (pdf != null) { await _dataSearcherService.Save(searchKey, pdf); _mqService.Push(new PdfMsg() { Content = pdf, Data = new PdfData() { DateCreated = DateTime.Now, Description = $"{searchKey} pdf", Topic = searchKey } }); } } //collect?.ForEach((t) => //{ // Console.WriteLine(t.Description); //}); } await Task.Delay(TimeSpan.FromHours(2), stoppingToken); } }