public override HealthCheck Check() { var automaticSearchEnabled = _indexerFactory.AutomaticSearchEnabled(false); if (automaticSearchEnabled.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Automatic Search enabled, Readarr will not provide any automatic search results")); } var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); if (interactiveSearchEnabled.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, "No indexers available with Interactive Search enabled, Readarr will not provide any interactive search results")); } var active = _indexerFactory.AutomaticSearchEnabled(true); if (active.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, "All search-capable indexers are temporarily unavailable due to recent indexer errors")); } return(new HealthCheck(GetType())); }
public override HealthCheck Check() { var automaticSearchEnabled = _indexerFactory.AutomaticSearchEnabled(false); if (automaticSearchEnabled.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAutomaticMessage"))); } var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); if (interactiveSearchEnabled.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoInteractiveMessage"))); } var active = _indexerFactory.AutomaticSearchEnabled(true); if (active.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAvailableIndexersMessage"))); } return(new HealthCheck(GetType())); }
public override HealthCheck Check() { var automaticSearchEnabled = _indexerFactory.AutomaticSearchEnabled(false); if (automaticSearchEnabled.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAutomaticMessage"), "#no-indexers-available-with-automatic-search-enabled-radarr-will-not-provide-any-automatic-search-results")); } var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); if (interactiveSearchEnabled.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoInteractiveMessage"), "#no-indexers-available-with-interactive-search-enabled")); } var active = _indexerFactory.AutomaticSearchEnabled(true); if (active.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAvailableIndexersMessage"), "#indexers-are-unavailable-due-to-failures")); } return(new HealthCheck(GetType())); }
public override HealthCheck Check() { var automaticSearchEnabled = _indexerFactory.AutomaticSearchEnabled(false); if (automaticSearchEnabled.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAutomaticMessage"), "#no_indexers_available_with_automatic_search_enabled_radarr_will_not_provide_any_automatic_search_results")); } var interactiveSearchEnabled = _indexerFactory.InteractiveSearchEnabled(false); if (interactiveSearchEnabled.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoInteractiveMessage"), "#no_indexers_available_with_interactive_search_enabled")); } var active = _indexerFactory.AutomaticSearchEnabled(true); if (active.Empty()) { return(new HealthCheck(GetType(), HealthCheckResult.Warning, _localizationService.GetLocalizedString("IndexerSearchCheckNoAvailableIndexersMessage"), "#indexers_are_unavailable_due_to_failures")); } return(new HealthCheck(GetType())); }
private List <DownloadDecision> Dispatch(Func <IIndexer, IEnumerable <ReleaseInfo> > searchAction, SearchCriteriaBase criteriaBase) { var indexers = criteriaBase.InteractiveSearch ? _indexerFactory.InteractiveSearchEnabled() : _indexerFactory.AutomaticSearchEnabled(); // Filter indexers to untagged indexers and indexers with intersecting tags indexers = indexers.Where(i => i.Definition.Tags.Empty() || i.Definition.Tags.Intersect(criteriaBase.Series.Tags).Any()).ToList(); var reports = new List <ReleaseInfo>(); _logger.ProgressInfo("Searching indexers for {0}. {1} active indexers", criteriaBase, indexers.Count); var taskList = new List <Task>(); var taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.None); foreach (var indexer in indexers) { var indexerLocal = indexer; taskList.Add(taskFactory.StartNew(() => { try { var indexerReports = searchAction(indexerLocal); lock (reports) { reports.AddRange(indexerReports); } } catch (Exception e) { _logger.Error(e, "Error while searching for {0}", criteriaBase); } }).LogExceptions()); } Task.WaitAll(taskList.ToArray()); _logger.Debug("Total of {0} reports were found for {1} from {2} indexers", reports.Count, criteriaBase, indexers.Count); // Update the last search time for all episodes if at least 1 indexer was searched. if (indexers.Any()) { var lastSearchTime = DateTime.UtcNow; _logger.Debug("Setting last search time to: {0}", lastSearchTime); criteriaBase.Episodes.ForEach(e => e.LastSearchTime = lastSearchTime); _episodeService.UpdateEpisodes(criteriaBase.Episodes); } return(_makeDownloadDecision.GetSearchDecision(reports, criteriaBase).ToList()); }
private List <DownloadDecision> Dispatch(Func <IIndexer, IEnumerable <ReleaseInfo> > searchAction, SearchCriteriaBase criteriaBase) { var indexers = criteriaBase.InteractiveSearch ? _indexerFactory.InteractiveSearchEnabled() : _indexerFactory.AutomaticSearchEnabled(); var reports = new List <ReleaseInfo>(); _logger.ProgressInfo("Searching {0} indexers for {1}", indexers.Count, criteriaBase); var taskList = new List <Task>(); var taskFactory = new TaskFactory(TaskCreationOptions.LongRunning, TaskContinuationOptions.None); foreach (var indexer in indexers) { var indexerLocal = indexer; taskList.Add(taskFactory.StartNew(() => { try { var indexerReports = searchAction(indexerLocal); lock (reports) { reports.AddRange(indexerReports); } } catch (Exception e) { _logger.Error(e, "Error while searching for {0}", criteriaBase); } }).LogExceptions()); } Task.WaitAll(taskList.ToArray()); _logger.Debug("Total of {0} reports were found for {1} from {2} indexers", reports.Count, criteriaBase, indexers.Count); return(_makeDownloadDecision.GetSearchDecision(reports, criteriaBase).ToList()); }