mirror of
https://github.com/Caraxi/mare.server.git
synced 2025-12-12 22:17:22 +01:00
update metrics more often
This commit is contained in:
parent
4c1131a988
commit
a66e93c901
1 changed files with 15 additions and 9 deletions
|
|
@ -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));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue