{"action":"created","comment":{"url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments/33890225","id":33890225,"diff_hunk":"@@ -257,6 +260,13 @@ private List<DownloadDecision> Dispatch(Func<IIndexer, IEnumerable<ReleaseInfo>>\n \n             foreach (var indexer in indexers)\n             {\n+                var indexerStatus = _indexerStatusService.GetIndexerStatus(indexer.Definition.Id);\n+                if (indexerStatus != null && indexerStatus.DisabledTill.HasValue && indexerStatus.DisabledTill.Value > DateTime.UtcNow)\n+                {\n+                    _logger.Debug(\"Temporarily ignoring indexer {0} till {1} due to recent failures.\", indexer.Definition.Name, indexerStatus.DisabledTill.Value);","path":"src/NzbDrone.Core/IndexerSearch/NzbSearchService.cs","position":31,"original_position":31,"commit_id":"c55fe0ea12fce7e96b9aff78fe784cd4eb347e34","original_commit_id":"c55fe0ea12fce7e96b9aff78fe784cd4eb347e34","user":{"login":"kayone","id":412280,"avatar_url":"https://avatars.githubusercontent.com/u/412280?v=3","gravatar_id":"","url":"https://api.github.com/users/kayone","html_url":"https://github.com/kayone","followers_url":"https://api.github.com/users/kayone/followers","following_url":"https://api.github.com/users/kayone/following{/other_user}","gists_url":"https://api.github.com/users/kayone/gists{/gist_id}","starred_url":"https://api.github.com/users/kayone/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kayone/subscriptions","organizations_url":"https://api.github.com/users/kayone/orgs","repos_url":"https://api.github.com/users/kayone/repos","events_url":"https://api.github.com/users/kayone/events{/privacy}","received_events_url":"https://api.github.com/users/kayone/received_events","type":"User","site_admin":false},"body":"maybe as info? users should be able to tell why an indexer isn't being used.","created_at":"2015-07-04T21:53:19Z","updated_at":"2015-07-04T21:53:19Z","html_url":"https://github.com/Sonarr/Sonarr/pull/648#discussion_r33890225","pull_request_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/648","_links":{"self":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments/33890225"},"html":{"href":"https://github.com/Sonarr/Sonarr/pull/648#discussion_r33890225"},"pull_request":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/648"}}},"pull_request":{"url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/648","id":38726846,"html_url":"https://github.com/Sonarr/Sonarr/pull/648","diff_url":"https://github.com/Sonarr/Sonarr/pull/648.diff","patch_url":"https://github.com/Sonarr/Sonarr/pull/648.patch","issue_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/648","number":648,"state":"open","locked":false,"title":"Back-off logic for indexers","user":{"login":"Taloth","id":6383890,"avatar_url":"https://avatars.githubusercontent.com/u/6383890?v=3","gravatar_id":"","url":"https://api.github.com/users/Taloth","html_url":"https://github.com/Taloth","followers_url":"https://api.github.com/users/Taloth/followers","following_url":"https://api.github.com/users/Taloth/following{/other_user}","gists_url":"https://api.github.com/users/Taloth/gists{/gist_id}","starred_url":"https://api.github.com/users/Taloth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Taloth/subscriptions","organizations_url":"https://api.github.com/users/Taloth/orgs","repos_url":"https://api.github.com/users/Taloth/repos","events_url":"https://api.github.com/users/Taloth/events{/privacy}","received_events_url":"https://api.github.com/users/Taloth/received_events","type":"User","site_admin":false},"body":"<s>Work in progress, but a request for comments.\r\nWon't actually run, didn't actually add a db migration yet.\r\n\r\nI'm not happy with how this is done architecturally.</s>\r\n\r\nThe IndexerStatusService seems okay. We could also do this in IndexerBase directly but the service seems a better option.\r\nThe IndexerStatus contains both back-off logic and last recent-feed tracking. Two separate features, but wanted to look at both coz it affects the architecture.\r\n\r\nThe back-off logic should be self-explanatory. Upon failure the indexer will not be used for a while, the duration will exponentially increase after every failure up to 24h. Every success will reduce the duration again.\r\nSo if you get Failure, Failure, Failure, Success, Failure. Then the Success won't actually completely reset the escalation.\r\n\r\nThe recent-feed tracking is intended to be able to grab multiple pages of the recent feed to catch up in case of a server or client down-time (non-24/7 operation). The status is used to determine how far back it needs to go and whether there's still a gap left.\r\nThe tracking should be okay (no tests yet), but the gaps aren't reported yet.\r\nThat should probably be done by event.\r\nI also didn't increase the number of allowed pages for the recent feed. But once we do we might be able to run Sonarr in non-24/7 mode, should make more than a few ppl happy.\r\n\r\nSeveral problems exist:\r\n1) <s>Since the nzb/torrent is grabbed in the DownloadClient instance, it's more difficult to differentiate between exceptions thrown by the nzb/torrent download and exceptions thrown by the download client. Atm I catch the exceptions in the caller (DownloadService).</s> done\r\n2) <s>HttpIndexerBase currently gets a reference to IIndexerStatusService, I'm thinking we might want to use events instead.</s> nope\r\n3) <s>Recent feed gaps aren't yet reported, we could raise an event, but we first have to run through all the indexers. So not sure how to do that properly. Could also just store the gap in the IndexerStatus and reset it when the MissingEpisode search finishes.</s> done\r\n4) <s>We need to add a HealthCheck to warn about it.</s> done\r\n\r\n","created_at":"2015-06-28T15:06:40Z","updated_at":"2015-07-04T21:53:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c241ac38292b97e32f78de9d10d48398d7271bcd","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/648/commits","review_comments_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/648/comments","review_comment_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/648/comments","statuses_url":"https://api.github.com/repos/Sonarr/Sonarr/statuses/c55fe0ea12fce7e96b9aff78fe784cd4eb347e34","head":{"label":"Sonarr:indexer-back-off","ref":"indexer-back-off","sha":"c55fe0ea12fce7e96b9aff78fe784cd4eb347e34","user":{"login":"Sonarr","id":1082903,"avatar_url":"https://avatars.githubusercontent.com/u/1082903?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonarr","html_url":"https://github.com/Sonarr","followers_url":"https://api.github.com/users/Sonarr/followers","following_url":"https://api.github.com/users/Sonarr/following{/other_user}","gists_url":"https://api.github.com/users/Sonarr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonarr/subscriptions","organizations_url":"https://api.github.com/users/Sonarr/orgs","repos_url":"https://api.github.com/users/Sonarr/repos","events_url":"https://api.github.com/users/Sonarr/events{/privacy}","received_events_url":"https://api.github.com/users/Sonarr/received_events","type":"Organization","site_admin":false},"repo":{"id":2465723,"name":"Sonarr","full_name":"Sonarr/Sonarr","owner":{"login":"Sonarr","id":1082903,"avatar_url":"https://avatars.githubusercontent.com/u/1082903?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonarr","html_url":"https://github.com/Sonarr","followers_url":"https://api.github.com/users/Sonarr/followers","following_url":"https://api.github.com/users/Sonarr/following{/other_user}","gists_url":"https://api.github.com/users/Sonarr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonarr/subscriptions","organizations_url":"https://api.github.com/users/Sonarr/orgs","repos_url":"https://api.github.com/users/Sonarr/repos","events_url":"https://api.github.com/users/Sonarr/events{/privacy}","received_events_url":"https://api.github.com/users/Sonarr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sonarr/Sonarr","description":"Smart PVR for newsgroup and bittorrent users.","fork":false,"url":"https://api.github.com/repos/Sonarr/Sonarr","forks_url":"https://api.github.com/repos/Sonarr/Sonarr/forks","keys_url":"https://api.github.com/repos/Sonarr/Sonarr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sonarr/Sonarr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sonarr/Sonarr/teams","hooks_url":"https://api.github.com/repos/Sonarr/Sonarr/hooks","issue_events_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/events{/number}","events_url":"https://api.github.com/repos/Sonarr/Sonarr/events","assignees_url":"https://api.github.com/repos/Sonarr/Sonarr/assignees{/user}","branches_url":"https://api.github.com/repos/Sonarr/Sonarr/branches{/branch}","tags_url":"https://api.github.com/repos/Sonarr/Sonarr/tags","blobs_url":"https://api.github.com/repos/Sonarr/Sonarr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sonarr/Sonarr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sonarr/Sonarr/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sonarr/Sonarr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sonarr/Sonarr/statuses/{sha}","languages_url":"https://api.github.com/repos/Sonarr/Sonarr/languages","stargazers_url":"https://api.github.com/repos/Sonarr/Sonarr/stargazers","contributors_url":"https://api.github.com/repos/Sonarr/Sonarr/contributors","subscribers_url":"https://api.github.com/repos/Sonarr/Sonarr/subscribers","subscription_url":"https://api.github.com/repos/Sonarr/Sonarr/subscription","commits_url":"https://api.github.com/repos/Sonarr/Sonarr/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sonarr/Sonarr/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sonarr/Sonarr/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sonarr/Sonarr/contents/{+path}","compare_url":"https://api.github.com/repos/Sonarr/Sonarr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sonarr/Sonarr/merges","archive_url":"https://api.github.com/repos/Sonarr/Sonarr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sonarr/Sonarr/downloads","issues_url":"https://api.github.com/repos/Sonarr/Sonarr/issues{/number}","pulls_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls{/number}","milestones_url":"https://api.github.com/repos/Sonarr/Sonarr/milestones{/number}","notifications_url":"https://api.github.com/repos/Sonarr/Sonarr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sonarr/Sonarr/labels{/name}","releases_url":"https://api.github.com/repos/Sonarr/Sonarr/releases{/id}","created_at":"2011-09-27T05:57:16Z","updated_at":"2015-07-04T01:50:29Z","pushed_at":"2015-07-04T21:12:17Z","git_url":"git://github.com/Sonarr/Sonarr.git","ssh_url":"git@github.com:Sonarr/Sonarr.git","clone_url":"https://github.com/Sonarr/Sonarr.git","svn_url":"https://github.com/Sonarr/Sonarr","homepage":"https://sonarr.tv","size":225377,"stargazers_count":725,"watchers_count":725,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":207,"mirror_url":null,"open_issues_count":292,"forks":207,"open_issues":292,"watchers":725,"default_branch":"develop"}},"base":{"label":"Sonarr:develop","ref":"develop","sha":"1ac27002e576bb0c8fb0cccdf01f29d1ef614c8d","user":{"login":"Sonarr","id":1082903,"avatar_url":"https://avatars.githubusercontent.com/u/1082903?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonarr","html_url":"https://github.com/Sonarr","followers_url":"https://api.github.com/users/Sonarr/followers","following_url":"https://api.github.com/users/Sonarr/following{/other_user}","gists_url":"https://api.github.com/users/Sonarr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonarr/subscriptions","organizations_url":"https://api.github.com/users/Sonarr/orgs","repos_url":"https://api.github.com/users/Sonarr/repos","events_url":"https://api.github.com/users/Sonarr/events{/privacy}","received_events_url":"https://api.github.com/users/Sonarr/received_events","type":"Organization","site_admin":false},"repo":{"id":2465723,"name":"Sonarr","full_name":"Sonarr/Sonarr","owner":{"login":"Sonarr","id":1082903,"avatar_url":"https://avatars.githubusercontent.com/u/1082903?v=3","gravatar_id":"","url":"https://api.github.com/users/Sonarr","html_url":"https://github.com/Sonarr","followers_url":"https://api.github.com/users/Sonarr/followers","following_url":"https://api.github.com/users/Sonarr/following{/other_user}","gists_url":"https://api.github.com/users/Sonarr/gists{/gist_id}","starred_url":"https://api.github.com/users/Sonarr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sonarr/subscriptions","organizations_url":"https://api.github.com/users/Sonarr/orgs","repos_url":"https://api.github.com/users/Sonarr/repos","events_url":"https://api.github.com/users/Sonarr/events{/privacy}","received_events_url":"https://api.github.com/users/Sonarr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Sonarr/Sonarr","description":"Smart PVR for newsgroup and bittorrent users.","fork":false,"url":"https://api.github.com/repos/Sonarr/Sonarr","forks_url":"https://api.github.com/repos/Sonarr/Sonarr/forks","keys_url":"https://api.github.com/repos/Sonarr/Sonarr/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Sonarr/Sonarr/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Sonarr/Sonarr/teams","hooks_url":"https://api.github.com/repos/Sonarr/Sonarr/hooks","issue_events_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/events{/number}","events_url":"https://api.github.com/repos/Sonarr/Sonarr/events","assignees_url":"https://api.github.com/repos/Sonarr/Sonarr/assignees{/user}","branches_url":"https://api.github.com/repos/Sonarr/Sonarr/branches{/branch}","tags_url":"https://api.github.com/repos/Sonarr/Sonarr/tags","blobs_url":"https://api.github.com/repos/Sonarr/Sonarr/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Sonarr/Sonarr/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Sonarr/Sonarr/git/refs{/sha}","trees_url":"https://api.github.com/repos/Sonarr/Sonarr/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Sonarr/Sonarr/statuses/{sha}","languages_url":"https://api.github.com/repos/Sonarr/Sonarr/languages","stargazers_url":"https://api.github.com/repos/Sonarr/Sonarr/stargazers","contributors_url":"https://api.github.com/repos/Sonarr/Sonarr/contributors","subscribers_url":"https://api.github.com/repos/Sonarr/Sonarr/subscribers","subscription_url":"https://api.github.com/repos/Sonarr/Sonarr/subscription","commits_url":"https://api.github.com/repos/Sonarr/Sonarr/commits{/sha}","git_commits_url":"https://api.github.com/repos/Sonarr/Sonarr/git/commits{/sha}","comments_url":"https://api.github.com/repos/Sonarr/Sonarr/comments{/number}","issue_comment_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/comments{/number}","contents_url":"https://api.github.com/repos/Sonarr/Sonarr/contents/{+path}","compare_url":"https://api.github.com/repos/Sonarr/Sonarr/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Sonarr/Sonarr/merges","archive_url":"https://api.github.com/repos/Sonarr/Sonarr/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Sonarr/Sonarr/downloads","issues_url":"https://api.github.com/repos/Sonarr/Sonarr/issues{/number}","pulls_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls{/number}","milestones_url":"https://api.github.com/repos/Sonarr/Sonarr/milestones{/number}","notifications_url":"https://api.github.com/repos/Sonarr/Sonarr/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Sonarr/Sonarr/labels{/name}","releases_url":"https://api.github.com/repos/Sonarr/Sonarr/releases{/id}","created_at":"2011-09-27T05:57:16Z","updated_at":"2015-07-04T01:50:29Z","pushed_at":"2015-07-04T21:12:17Z","git_url":"git://github.com/Sonarr/Sonarr.git","ssh_url":"git@github.com:Sonarr/Sonarr.git","clone_url":"https://github.com/Sonarr/Sonarr.git","svn_url":"https://github.com/Sonarr/Sonarr","homepage":"https://sonarr.tv","size":225377,"stargazers_count":725,"watchers_count":725,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":207,"mirror_url":null,"open_issues_count":292,"forks":207,"open_issues":292,"watchers":725,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/648"},"html":{"href":"https://github.com/Sonarr/Sonarr/pull/648"},"issue":{"href":"https://api.github.com/repos/Sonarr/Sonarr/issues/648"},"comments":{"href":"https://api.github.com/repos/Sonarr/Sonarr/issues/648/comments"},"review_comments":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/648/comments"},"review_comment":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/648/commits"},"statuses":{"href":"https://api.github.com/repos/Sonarr/Sonarr/statuses/c55fe0ea12fce7e96b9aff78fe784cd4eb347e34"}}}}