Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillKurdyukov committed Aug 15, 2024
1 parent da5880c commit 9bb933d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions slo/src/Internal/SloContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,14 @@ public async Task Run(RunConfig runConfig)

_logger.LogInformation("Started write / read shooting..");

await Task.WhenAll(readTask, writeTask);
try
{
await Task.WhenAll(readTask, writeTask);
}
catch (Exception e)
{
_logger.LogError(e, "Failed waiting read / write tasks");
}

await prometheus.StopAsync();
await MetricReset(promPgwEndpoint);
Expand All @@ -156,13 +163,16 @@ Task ShootingTask(RateLimiter rateLimitPolicy, string shootingName,
// ReSharper disable once MethodSupportsCancellation
return Task.Run(async () =>
{
var tasks = new List<Task>();
while (!cancellationTokenSource.Token.IsCancellationRequested)
{
using var lease = await rateLimitPolicy
.AcquireAsync(cancellationToken: cancellationTokenSource.Token);
if (lease.IsAcquired)
{
continue;
}
_ = Task.Run(async () =>
{
var sw = Stopwatch.StartNew();
Expand All @@ -171,8 +181,6 @@ Task ShootingTask(RateLimiter rateLimitPolicy, string shootingName,
if (statusCode != StatusCode.Success)
{
_logger.LogError("Failed {ShootingName} operation code: {StatusCode}", shootingName,
statusCode);
notOkGauge.Inc();
label = "err";
}
Expand Down

0 comments on commit 9bb933d

Please sign in to comment.