private void HandleResult(AdvertJobResult result, AdvertEntry entry) { _logger.LogInformation($"({entry.RunningJobsCount} jobs) Grabber task successful ({result.Contacts?.Count ?? 0} contacts): " + result.Text?.Substring(0, Math.Min(result.Text.Length, 40))); // TODO: create export jobs entry.RunningJobsCount--; }
public AdvertJobResult Process(AdvertJob job) { var result = new AdvertJobResult { Job = job }; var adResponse = _client.GetAsync(_config.GetAdvertDataUrl(job.Id)).Result; if (adResponse.IsSuccessStatusCode) { result.Text = ExtractAdTextFromJsonString(adResponse.Content.ReadAsStringAsync().Result); } else { throw new HttpRequestException("Response code: " + adResponse.StatusCode); } var contactsResponse = _client.GetAsync(_config.GetAdvertContactUrl(job.Id)).Result; if (contactsResponse.IsSuccessStatusCode) { result.Contacts = ExtractAdContactsFromJsonString(contactsResponse.Content.ReadAsStringAsync().Result); } return(result); }