{"action":"created","comment":{"url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments/22489763","id":22489763,"diff_hunk":"@@ -0,0 +1,50 @@\n+﻿using System;\n+using System.Collections.Generic;\n+using System.Linq;\n+using System.Text;\n+using System.Threading;\n+using NzbDrone.Common.Cache;\n+\n+namespace NzbDrone.Common.UniqueIdentifier\n+{\n+    public interface IUniqueIdentifierGenerator\n+    {\n+        int Get(string key);\n+    }\n+\n+    public class UniqueIdentifierGenerator : IUniqueIdentifierGenerator\n+    {\n+        private static int _lastIdentifier;\n+\n+        private ICached<int> _cache;\n+\n+        public UniqueIdentifierGenerator(ICacheManager cacheManager)\n+        {\n+            _cache = cacheManager.GetCache<int>(typeof(UniqueIdentifierGenerator));\n+        }\n+\n+        public int Get(string key)\n+        {\n+            return _cache.Get(key, GetNextIdentifier, TimeSpan.FromHours(24));","path":"src/NzbDrone.Common/UniqueIdentifier/UniqueIdentifierGenerator.cs","position":28,"original_position":28,"commit_id":"5cf701522ba1c508e3a87e5097685e52aa4dd922","original_commit_id":"5cf701522ba1c508e3a87e5097685e52aa4dd922","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":"what if you let it overflow? and then do `Math.Abs`","created_at":"2015-01-05T21:10:11Z","updated_at":"2015-01-05T21:10:11Z","html_url":"https://github.com/Sonarr/Sonarr/pull/162#discussion_r22489763","pull_request_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/162","_links":{"self":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments/22489763"},"html":{"href":"https://github.com/Sonarr/Sonarr/pull/162#discussion_r22489763"},"pull_request":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/162"}}},"pull_request":{"url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/162","id":26599969,"html_url":"https://github.com/Sonarr/Sonarr/pull/162","diff_url":"https://github.com/Sonarr/Sonarr/pull/162.diff","patch_url":"https://github.com/Sonarr/Sonarr/pull/162.patch","issue_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/162","number":162,"state":"open","locked":false,"title":"Now generating unique ids for queue items sent to the api","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":"To get rid of the id issues for the api.\r\nThe generator will create a new id for every key, and will preserve that id for 24h.\r\n","created_at":"2014-12-26T13:59:26Z","updated_at":"2015-01-05T21:10:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5c984e6a49e80935f7b710c01d0f91ee930fdc87","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/162/commits","review_comments_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/162/comments","review_comment_url":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments/{number}","comments_url":"https://api.github.com/repos/Sonarr/Sonarr/issues/162/comments","statuses_url":"https://api.github.com/repos/Sonarr/Sonarr/statuses/5cf701522ba1c508e3a87e5097685e52aa4dd922","head":{"label":"Sonarr:uid-generator","ref":"uid-generator","sha":"5cf701522ba1c508e3a87e5097685e52aa4dd922","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-01-05T10:05:25Z","pushed_at":"2015-01-05T20:37:47Z","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":208663,"stargazers_count":328,"watchers_count":328,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":101,"mirror_url":null,"open_issues_count":6,"forks":101,"open_issues":6,"watchers":328,"default_branch":"develop"}},"base":{"label":"Sonarr:develop","ref":"develop","sha":"85f7195d5707fd07a2b72df3efedd82492190284","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-01-05T10:05:25Z","pushed_at":"2015-01-05T20:37:47Z","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":208663,"stargazers_count":328,"watchers_count":328,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":101,"mirror_url":null,"open_issues_count":6,"forks":101,"open_issues":6,"watchers":328,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/162"},"html":{"href":"https://github.com/Sonarr/Sonarr/pull/162"},"issue":{"href":"https://api.github.com/repos/Sonarr/Sonarr/issues/162"},"comments":{"href":"https://api.github.com/repos/Sonarr/Sonarr/issues/162/comments"},"review_comments":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/162/comments"},"review_comment":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/Sonarr/Sonarr/pulls/162/commits"},"statuses":{"href":"https://api.github.com/repos/Sonarr/Sonarr/statuses/5cf701522ba1c508e3a87e5097685e52aa4dd922"}}}}