stabilizaiton work - projects rework for maintenanceability and ui livening
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace StellaOps.Provcache;
|
||||
|
||||
public sealed partial class WriteBehindQueue
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public ValueTask EnqueueAsync(ProvcacheEntry entry, CancellationToken cancellationToken = default)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(entry);
|
||||
|
||||
var item = new WriteBehindItem
|
||||
{
|
||||
Entry = entry,
|
||||
EnqueuedAt = _timeProvider.GetUtcNow(),
|
||||
RetryCount = 0
|
||||
};
|
||||
|
||||
Interlocked.Increment(ref _totalEnqueued);
|
||||
Interlocked.Increment(ref _currentQueueDepth);
|
||||
ProvcacheTelemetry.SetWriteBehindQueueSize((int)Interlocked.Read(ref _currentQueueDepth));
|
||||
|
||||
return _channel.Writer.WriteAsync(item, cancellationToken);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user