feat: add slow consumer per-kind tracking with account counters (Gap 5.5)
Adds SlowConsumerTracker class for per-ClientKind slow consumer counting with configurable threshold callbacks, and extends Account with atomic IncrementSlowConsumers/SlowConsumerCount/ResetSlowConsumerCount members. Includes 10 unit tests covering concurrency, threshold firing, and reset.
This commit is contained in:
@@ -152,6 +152,16 @@ public sealed class Account : IDisposable
|
||||
return true;
|
||||
}
|
||||
|
||||
// Slow consumer tracking
|
||||
// Go reference: server/client.go — handleSlowConsumer, markConnAsSlow, server/accounts.go slowConsumerCount
|
||||
private long _slowConsumerCount;
|
||||
|
||||
public long SlowConsumerCount => Interlocked.Read(ref _slowConsumerCount);
|
||||
|
||||
public void IncrementSlowConsumers() => Interlocked.Increment(ref _slowConsumerCount);
|
||||
|
||||
public void ResetSlowConsumerCount() => Interlocked.Exchange(ref _slowConsumerCount, 0L);
|
||||
|
||||
// Per-account message/byte stats
|
||||
private long _inMsgs;
|
||||
private long _outMsgs;
|
||||
|
||||
Reference in New Issue
Block a user