private void Refresh() { _refreshDebounce.Pause(); try { var downloadClients = _downloadClientFactory.DownloadHandlingEnabled(); var trackedDownloads = new List <TrackedDownload>(); foreach (var downloadClient in downloadClients) { var clientTrackedDownloads = ProcessClientDownloads(downloadClient); trackedDownloads.AddRange(clientTrackedDownloads.Where(DownloadIsTrackable)); } _trackedDownloadService.UpdateTrackable(trackedDownloads); _eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(trackedDownloads)); _manageCommandQueue.Push(new ProcessMonitoredDownloadsCommand(), CommandPriority.High); } finally { _refreshDebounce.Resume(); } }
public void should_hold_the_call_while_paused() { var counter = new Counter(); var debounceFunction = new Debouncer(counter.Hit, TimeSpan.FromMilliseconds(50)); debounceFunction.Pause(); debounceFunction.Execute(); debounceFunction.Execute(); Thread.Sleep(100); counter.Count.Should().Be(0); debounceFunction.Execute(); debounceFunction.Execute(); Thread.Sleep(100); counter.Count.Should().Be(0); debounceFunction.Resume(); Thread.Sleep(20); counter.Count.Should().Be(0); Thread.Sleep(100); counter.Count.Should().Be(1); }
private QueueStatusResource GetQueueStatus() { _broadcastDebounce.Pause(); var queue = _queueService.GetQueue(); var pending = _pendingReleaseService.GetPendingQueue(); var resource = new QueueStatusResource { TotalCount = queue.Count + pending.Count, Count = queue.Count(q => q.Artist != null) + pending.Count, UnknownCount = queue.Count(q => q.Artist == null), Errors = queue.Any(q => q.Artist != null && q.TrackedDownloadStatus.Equals("Error", StringComparison.InvariantCultureIgnoreCase)), Warnings = queue.Any(q => q.Artist != null && q.TrackedDownloadStatus.Equals("Warning", StringComparison.InvariantCultureIgnoreCase)), UnknownErrors = queue.Any(q => q.Artist == null && q.TrackedDownloadStatus.Equals("Error", StringComparison.InvariantCultureIgnoreCase)), UnknownWarnings = queue.Any(q => q.Artist == null && q.TrackedDownloadStatus.Equals("Warning", StringComparison.InvariantCultureIgnoreCase)) }; _broadcastDebounce.Resume(); return resource; }
private void Refresh() { _refreshDebounce.Pause(); try { var downloadClients = _downloadClientProvider.GetDownloadClients(); var trackedDownload = new List <TrackedDownload>(); foreach (var downloadClient in downloadClients) { var clientTrackedDownloads = ProcessClientDownloads(downloadClient); trackedDownload.AddRange(clientTrackedDownloads.Where(c => c.State == TrackedDownloadStage.Downloading)); } _eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(trackedDownload)); } finally { _refreshDebounce.Resume(); } }
private QueueStatusResource GetQueueStatus() { _broadcastDebounce.Pause(); var queue = _queueService.GetQueue(); var pending = _pendingReleaseService.GetPendingQueue(); var resource = new QueueStatusResource { TotalCount = queue.Count + pending.Count, Count = queue.Count(q => q.Artist != null) + pending.Count, UnknownCount = queue.Count(q => q.Artist == null), Errors = queue.Any(q => q.Artist != null && q.TrackedDownloadStatus == TrackedDownloadStatus.Error), Warnings = queue.Any(q => q.Artist != null && q.TrackedDownloadStatus == TrackedDownloadStatus.Warning), UnknownErrors = queue.Any(q => q.Artist == null && q.TrackedDownloadStatus == TrackedDownloadStatus.Error), UnknownWarnings = queue.Any(q => q.Artist == null && q.TrackedDownloadStatus == TrackedDownloadStatus.Warning) }; _broadcastDebounce.Resume(); return(resource); }
private void Refresh() { _refreshDebounce.Pause(); try { var downloadClients = _downloadClientProvider.GetDownloadClients(); var trackedDownloads = new List <TrackedDownload>(); foreach (var downloadClient in downloadClients) { var clientTrackedDownloads = ProcessClientDownloads(downloadClient); // Only track completed downloads if trackedDownloads.AddRange(clientTrackedDownloads.Where(DownloadIsTrackable)); } _eventAggregator.PublishEvent(new TrackedDownloadRefreshedEvent(trackedDownloads)); } finally { _refreshDebounce.Resume(); } }