update metrics more often
This commit is contained in:
@@ -125,7 +125,20 @@ public class RequestQueueService : IHostedService
|
|||||||
|
|
||||||
private async void ProcessQueue(object src, ElapsedEventArgs e)
|
private async void ProcessQueue(object src, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
if (_queueProcessingSemaphore.CurrentCount == 0) return;
|
_logger.LogDebug("Periodic Processing Queue Start");
|
||||||
|
_metrics.SetGaugeTo(MetricsAPI.GaugeQueueFree, _userQueueRequests.Count(c => c == null));
|
||||||
|
_metrics.SetGaugeTo(MetricsAPI.GaugeQueueActive, _userQueueRequests.Count(c => c != null && c.IsActive));
|
||||||
|
_metrics.SetGaugeTo(MetricsAPI.GaugeQueueInactive, _userQueueRequests.Count(c => c != null && !c.IsActive));
|
||||||
|
_metrics.SetGaugeTo(MetricsAPI.GaugeDownloadQueue, _queue.Count(q => !q.IsCancelled));
|
||||||
|
_metrics.SetGaugeTo(MetricsAPI.GaugeDownloadQueueCancelled, _queue.Count(q => q.IsCancelled));
|
||||||
|
_metrics.SetGaugeTo(MetricsAPI.GaugeDownloadPriorityQueue, _priorityQueue.Count(q => !q.IsCancelled));
|
||||||
|
_metrics.SetGaugeTo(MetricsAPI.GaugeDownloadPriorityQueueCancelled, _priorityQueue.Count(q => q.IsCancelled));
|
||||||
|
|
||||||
|
if (_queueProcessingSemaphore.CurrentCount == 0)
|
||||||
|
{
|
||||||
|
_logger.LogDebug("Aborting Periodic Processing Queue, processing still running");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
await _queueProcessingSemaphore.WaitAsync().ConfigureAwait(false);
|
await _queueProcessingSemaphore.WaitAsync().ConfigureAwait(false);
|
||||||
|
|
||||||
@@ -186,14 +199,7 @@ public class RequestQueueService : IHostedService
|
|||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
_queueProcessingSemaphore.Release();
|
_queueProcessingSemaphore.Release();
|
||||||
|
_logger.LogDebug("Periodic Processing Queue End");
|
||||||
}
|
}
|
||||||
|
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeQueueFree, _userQueueRequests.Count(c => c == null));
|
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeQueueActive, _userQueueRequests.Count(c => c != null && c.IsActive));
|
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeQueueInactive, _userQueueRequests.Count(c => c != null && !c.IsActive));
|
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeDownloadQueue, _queue.Count(q => !q.IsCancelled));
|
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeDownloadQueueCancelled, _queue.Count(q => q.IsCancelled));
|
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeDownloadPriorityQueue, _priorityQueue.Count(q => !q.IsCancelled));
|
|
||||||
_metrics.SetGaugeTo(MetricsAPI.GaugeDownloadPriorityQueueCancelled, _priorityQueue.Count(q => q.IsCancelled));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user