From 7b5cae2e99d9ea82d7a536862d4af4092c4416d5 Mon Sep 17 00:00:00 2001 From: KirillKurdyukov Date: Thu, 15 Aug 2024 11:01:12 +0300 Subject: [PATCH] new strategy --- slo/src/Internal/SloContext.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/slo/src/Internal/SloContext.cs b/slo/src/Internal/SloContext.cs index 9b25ba9f..5f7f6469 100644 --- a/slo/src/Internal/SloContext.cs +++ b/slo/src/Internal/SloContext.cs @@ -125,8 +125,8 @@ public async Task Run(RunConfig runConfig) var errorsGauge = metricFactory.CreateGauge("errors", "amount of errors", new[] { "class", "in" }); - var writeLimiter = Policy.RateLimit(runConfig.WriteRps, TimeSpan.FromSeconds(1), runConfig.WriteRps); - var readLimiter = Policy.RateLimit(runConfig.ReadRps, TimeSpan.FromSeconds(1), runConfig.ReadRps); + var writeLimiter = Policy.RateLimit(runConfig.WriteRps, TimeSpan.FromSeconds(1), 10); + var readLimiter = Policy.RateLimit(runConfig.ReadRps, TimeSpan.FromSeconds(1), 10); var cancellationTokenSource = new CancellationTokenSource(); cancellationTokenSource.CancelAfter(TimeSpan.FromSeconds(runConfig.ShutdownTime)); @@ -189,7 +189,7 @@ Task ShootingTask(RateLimitPolicy rateLimitPolicy, string shootingName, _logger.LogInformation(e, "Waiting {ShootingName} task, count active tasks: {}", shootingName, Interlocked.Read(ref activeTasks)); - await Task.Delay(990, cancellationTokenSource.Token); + await Task.Delay(e.RetryAfter, cancellationTokenSource.Token); } }