Skip to content

Commit efa59be

Browse files
Dev: Added delay to shooting task
1 parent 8c9a1ec commit efa59be

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

slo/src/Internal/SloTableContext.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public interface ISloContext
1919

2020
public abstract class SloTableContext<T> : ISloContext
2121
{
22+
private const int IntervalMs = 100;
23+
2224
protected static readonly ILogger Logger = ISloContext.Factory.CreateLogger<SloTableContext<T>>();
2325

2426
private volatile int _maxId;
@@ -95,11 +97,11 @@ public async Task Run(RunConfig runConfig)
9597

9698
var writeLimiter = new FixedWindowRateLimiter(new FixedWindowRateLimiterOptions
9799
{
98-
Window = TimeSpan.FromMilliseconds(100), PermitLimit = runConfig.WriteRps / 10, QueueLimit = int.MaxValue
100+
Window = TimeSpan.FromMilliseconds(IntervalMs), PermitLimit = runConfig.WriteRps / 10, QueueLimit = int.MaxValue
99101
});
100102
var readLimiter = new FixedWindowRateLimiter(new FixedWindowRateLimiterOptions
101103
{
102-
Window = TimeSpan.FromMilliseconds(100), PermitLimit = runConfig.ReadRps / 10, QueueLimit = int.MaxValue
104+
Window = TimeSpan.FromMilliseconds(IntervalMs), PermitLimit = runConfig.ReadRps / 10, QueueLimit = int.MaxValue
103105
});
104106

105107
var cancellationTokenSource = new CancellationTokenSource();
@@ -208,6 +210,9 @@ Task ShootingTask(RateLimiter rateLimitPolicy, string operationType,
208210

209211
_ = Task.Run(async () =>
210212
{
213+
await Task.Delay(TimeSpan.FromSeconds(Random.Shared.Next(IntervalMs)),
214+
cancellationToken: cancellationTokenSource.Token);
215+
211216
try
212217
{
213218
pendingOperations.Inc();

src/Ydb.Sdk/CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
- Added new ADO.NET options:
2222
- `MinSessionPool`: The minimum connection pool size.
2323
- `SessionIdleTimeout`: The time (in seconds) to wait before closing idle session in the pool if the count of all sessions exceeds `MinSessionPool`.
24-
- `SessionPruningInterval`: How many seconds the pool waits before attempting to prune idle sessions (see `SessionIdleTimeout`).
2524
- Fixed bug `Reader`: unhandled exception in `TryReadRequestBytes(long bytes)`.
2625
- Handle `YdbException` on `DeleteSession`.
2726
- Do not invoke `DeleteSession` if the session is not active.

0 commit comments

Comments
 (0)