using DeepL; using Polly; using Polly.Retry; namespace FictionArchive.Service.TranslationService.Services.Resilience; public static class TranslationResiliencePipeline { public static ResiliencePipeline Build() { return new ResiliencePipelineBuilder() .AddRetry(new RetryStrategyOptions { ShouldHandle = new PredicateBuilder() .Handle() .Handle(ex => ex.InnerException is TimeoutException) .Handle() .Handle(), MaxRetryAttempts = 3, BackoffType = DelayBackoffType.Exponential, Delay = TimeSpan.FromMilliseconds(500), UseJitter = true }) .Build(); } }