private static async Task<JobDetails> GetJobWithRetry(IJobSubmissionClient client, string jobId, CancellationToken cancellationToken) { JobDetails jobDetailsResults = null; var pollingInterval = GetPollingInterval(); int retryCount = 0; while (jobDetailsResults.IsNull()) { try { jobDetailsResults = await client.GetJobAsync(jobId); break; } catch (HttpLayerException) { if (retryCount >= Constants.RetryCount) { throw; } cancellationToken.WaitForInterval(TimeSpan.FromMilliseconds(pollingInterval)); retryCount++; } } return jobDetailsResults; }