Add Kubernetes and Jira MCP tools with auto-registration
This commit is contained in:
@@ -1,10 +1,25 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Polly;
|
||||
using RestSharp;
|
||||
|
||||
namespace LazyBear.MCP.Services.Jira;
|
||||
|
||||
public static class JiraClientFactory
|
||||
{
|
||||
private static readonly TimeSpan[] BackoffDurations = {
|
||||
TimeSpan.FromMilliseconds(1000),
|
||||
TimeSpan.FromMilliseconds(2000),
|
||||
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)
|
||||
{
|
||||
var jiraUrl = configuration["Jira:Url"] ?? "";
|
||||
@@ -20,6 +35,6 @@ public static class JiraClientFactory
|
||||
Timeout = TimeSpan.FromMilliseconds(30000)
|
||||
};
|
||||
|
||||
return new RestClient(config);
|
||||
return _retryPolicy.Wrap(new RestClient(config));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user