Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add polly retry to get artifact URL from DevOps
  • Loading branch information
praveenkuttappan committed Apr 17, 2024
commit abd6b96be19f5a2dec0bebe9fee4da7ee95fb453
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,10 @@ public async Task<Stream> DownloadPackageArtifact(string repoName, string buildI

private async Task<string> getDownloadArtifactUrl(string buildId, string artifactName, string project)
{
var maxRetryAttempts = 5;
var pauseBetweenFailures = TimeSpan.FromSeconds(2);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this number arbritary? or it has history to it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 seconds should be ideally enough to start the delay span. So, it's just arbitrary.

var retryPolicy = Policy
.Handle<HttpRequestException>()
.WaitAndRetryAsync(maxRetryAttempts, i => pauseBetweenFailures);
.WaitAndRetryAsync(5, i => pauseBetweenFailures);

var connection = await CreateVssConnection();
var buildClient = connection.GetClient<BuildHttpClient>();
Expand Down