Исправление ошибок сборки JiraClientFactory
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Polly;
|
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
|
|
||||||
namespace LazyBear.MCP.Services.Jira;
|
namespace LazyBear.MCP.Services.Jira;
|
||||||
@@ -12,14 +11,6 @@ public static class JiraClientFactory
|
|||||||
TimeSpan.FromMilliseconds(4000)
|
TimeSpan.FromMilliseconds(4000)
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Policy _retryPolicy = Policy
|
|
||||||
.HandleResult<RestResponse>(response => !response.IsSuccessful && response.StatusCode == System.Net.HttpStatusCode.TooManyRequests)
|
|
||||||
.Or<RestException>()
|
|
||||||
.WaitAndRetryAsync(
|
|
||||||
retryCount: 3,
|
|
||||||
sleepDurationProvider: attempt => BackoffDurations[attempt],
|
|
||||||
onRetry: (outcome, timespan, attempt, context) => { });
|
|
||||||
|
|
||||||
public static RestClient CreateClient(IConfiguration configuration)
|
public static RestClient CreateClient(IConfiguration configuration)
|
||||||
{
|
{
|
||||||
var jiraUrl = configuration["Jira:Url"] ?? "";
|
var jiraUrl = configuration["Jira:Url"] ?? "";
|
||||||
@@ -35,6 +26,6 @@ public static class JiraClientFactory
|
|||||||
Timeout = TimeSpan.FromMilliseconds(30000)
|
Timeout = TimeSpan.FromMilliseconds(30000)
|
||||||
};
|
};
|
||||||
|
|
||||||
return _retryPolicy.Wrap(new RestClient(config));
|
return new RestClient(config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user