namespace PrivaPub.Infrastructure.Jobs { public static class Backoff { public static TimeSpan After(int attempt) => TimeSpan.FromSeconds(Math.Pow(attempt, 4) + 15 + Random.Shared.Next(10) * (attempt + 1)); public static TimeSpan HostQuarantine(int consecutiveFailures, int threshold) => consecutiveFailures < threshold ? TimeSpan.Zero : TimeSpan.FromHours(Math.Min(Math.Pow(2, consecutiveFailures - threshold), 24 * 7)); } }