public void ReportStatus(CancellationToken cancellationToken) { try { var failureRate = (Uris.Count() - ProcessedDicomFiles.Count) / Uris.Count(); if (failureRate > FailureThreshold) { var retry = Retries < MaxRetry; resultsService.ReportFailure(TaskId, retry, cancellationToken); Logger.LogInformation( "Task marked as failed with failure rate={0}, total={1}, failed={2}, processed={3}, retry={4}", failureRate, Uris.Count(), FailedDicomFiles.Count + FailedFiles.Count, ProcessedDicomFiles.Count, retry); } else { resultsService.ReportSuccess(TaskId, cancellationToken); Logger.LogInformation("Task marked as successful"); } } catch (System.Exception ex) { Logger.LogError("Failed to report status back to Results Service: {0}", ex); } }