{"action":"created","comment":{"url":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/comments/55274439","id":55274439,"diff_hunk":"@@ -356,34 +339,139 @@\n \n (schema/defn ^:always-validate environment-class-info-entry\n   :- EnvironmentClassInfoCacheEntry\n-  \"Create an environment class info entry\"\n-  ([]\n-   (environment-class-info-entry nil))\n-  ([tag :- (schema/maybe schema/Str)]\n-   {:tag tag\n-    :last-updated (System/currentTimeMillis)}))\n+  \"Create an environment class info entry.  The return value will have a nil\n+  tag and cache-generation-id set to 1.\"\n+  []\n+  {:tag nil\n+   :cache-generation-id 1})\n+\n+(schema/defn ^:always-validate inc-cache-generation-id-for-class-info-entry\n+  :- EnvironmentClassInfoCacheEntry\n+  \"Return the supplied 'original-environment-class-info-entry' class info entry,\n+  only updated with a cache-generation-id value that has been incremented.\n+  If the supplied parameter is nil, the return value will have a tag set to\n+  nil and cache-generation-id set to 1.\"\n+  [original-environment-class-info-entry :-\n+   (schema/maybe EnvironmentClassInfoCacheEntry)]\n+  (if original-environment-class-info-entry\n+    (update original-environment-class-info-entry\n+            :cache-generation-id\n+            #(if (= % Long/MAX_VALUE) Long/MIN_VALUE (inc %)))","path":"src/clj/puppetlabs/services/jruby/jruby_puppet_core.clj","position":null,"original_position":60,"commit_id":"66022c15a98b1f58636e7fefdb735c6f34d9d413","original_commit_id":"0a954cba48df84fb57e1845a4b2f0da307331d89","user":{"login":"camlow325","id":5652737,"avatar_url":"https://avatars.githubusercontent.com/u/5652737?v=3","gravatar_id":"","url":"https://api.github.com/users/camlow325","html_url":"https://github.com/camlow325","followers_url":"https://api.github.com/users/camlow325/followers","following_url":"https://api.github.com/users/camlow325/following{/other_user}","gists_url":"https://api.github.com/users/camlow325/gists{/gist_id}","starred_url":"https://api.github.com/users/camlow325/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camlow325/subscriptions","organizations_url":"https://api.github.com/users/camlow325/orgs","repos_url":"https://api.github.com/users/camlow325/repos","events_url":"https://api.github.com/users/camlow325/events{/privacy}","received_events_url":"https://api.github.com/users/camlow325/received_events","type":"User","site_admin":false},"body":"Replaced the code with `inc` in 66022c1.","created_at":"2016-03-07T21:23:21Z","updated_at":"2016-03-07T21:23:21Z","html_url":"https://github.com/puppetlabs/puppet-server/pull/944#discussion_r55274439","pull_request_url":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/944","_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/comments/55274439"},"html":{"href":"https://github.com/puppetlabs/puppet-server/pull/944#discussion_r55274439"},"pull_request":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/944"}}},"pull_request":{"url":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/944","id":61868267,"html_url":"https://github.com/puppetlabs/puppet-server/pull/944","diff_url":"https://github.com/puppetlabs/puppet-server/pull/944.diff","patch_url":"https://github.com/puppetlabs/puppet-server/pull/944.patch","issue_url":"https://api.github.com/repos/puppetlabs/puppet-server/issues/944","number":944,"state":"open","locked":false,"title":"(SERVER-1183) Add entry to env class cache if not present during get","user":{"login":"camlow325","id":5652737,"avatar_url":"https://avatars.githubusercontent.com/u/5652737?v=3","gravatar_id":"","url":"https://api.github.com/users/camlow325","html_url":"https://github.com/camlow325","followers_url":"https://api.github.com/users/camlow325/followers","following_url":"https://api.github.com/users/camlow325/following{/other_user}","gists_url":"https://api.github.com/users/camlow325/gists{/gist_id}","starred_url":"https://api.github.com/users/camlow325/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camlow325/subscriptions","organizations_url":"https://api.github.com/users/camlow325/orgs","repos_url":"https://api.github.com/users/camlow325/repos","events_url":"https://api.github.com/users/camlow325/events{/privacy}","received_events_url":"https://api.github.com/users/camlow325/received_events","type":"User","site_admin":false},"body":"This PR is a replacement for #930, which was originally targeted at the\r\nmaster branch.\r\n\r\nThis PR replaces the use of a timestamp for synchronization of tags\r\nin the environment class info cache with an incrementing integer, called\r\nthe `cache-generation-id`.\r\n\r\nThis PR adds some logic behind the\r\n`get-environment-class-info-tag-cache-generation-id!` call in the\r\njruby-puppet-service to update the environment class info cache with a\r\nnew entry for the environment being queried in the event that no prior\r\nentry existed for that environment. This allows any subsequent\r\n`mark-all-environments-expired!` calls that may be made to the service to\r\nupdate the cache-generation-id in the cache for the environment and,\r\ntherefore, for the logic added in #926 to avoid updating the\r\ncache with a stale tag to be used for the case where the get precedes a\r\n`mark-all-environments-expired!` call.\r\n\r\nThis PR also refactors some of the logic in the jruby-puppet-service\r\nnamespace related to environment class cache maintenance down into\r\nthe jruby-puppet-core namespace and addresses some previously\r\nunaddressed PR comments from #926 and #933.","created_at":"2016-03-07T03:17:10Z","updated_at":"2016-03-07T21:23:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e144a37ac1f2260f47b5e87d3486b4d07c917b62","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/944/commits","review_comments_url":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/944/comments","review_comment_url":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/puppetlabs/puppet-server/issues/944/comments","statuses_url":"https://api.github.com/repos/puppetlabs/puppet-server/statuses/66022c15a98b1f58636e7fefdb735c6f34d9d413","head":{"label":"camlow325:bug/stable/SERVER-1183-env-classes-etag-all-env-expire-race-condition","ref":"bug/stable/SERVER-1183-env-classes-etag-all-env-expire-race-condition","sha":"66022c15a98b1f58636e7fefdb735c6f34d9d413","user":{"login":"camlow325","id":5652737,"avatar_url":"https://avatars.githubusercontent.com/u/5652737?v=3","gravatar_id":"","url":"https://api.github.com/users/camlow325","html_url":"https://github.com/camlow325","followers_url":"https://api.github.com/users/camlow325/followers","following_url":"https://api.github.com/users/camlow325/following{/other_user}","gists_url":"https://api.github.com/users/camlow325/gists{/gist_id}","starred_url":"https://api.github.com/users/camlow325/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camlow325/subscriptions","organizations_url":"https://api.github.com/users/camlow325/orgs","repos_url":"https://api.github.com/users/camlow325/repos","events_url":"https://api.github.com/users/camlow325/events{/privacy}","received_events_url":"https://api.github.com/users/camlow325/received_events","type":"User","site_admin":false},"repo":{"id":24697001,"name":"puppet-server","full_name":"camlow325/puppet-server","owner":{"login":"camlow325","id":5652737,"avatar_url":"https://avatars.githubusercontent.com/u/5652737?v=3","gravatar_id":"","url":"https://api.github.com/users/camlow325","html_url":"https://github.com/camlow325","followers_url":"https://api.github.com/users/camlow325/followers","following_url":"https://api.github.com/users/camlow325/following{/other_user}","gists_url":"https://api.github.com/users/camlow325/gists{/gist_id}","starred_url":"https://api.github.com/users/camlow325/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camlow325/subscriptions","organizations_url":"https://api.github.com/users/camlow325/orgs","repos_url":"https://api.github.com/users/camlow325/repos","events_url":"https://api.github.com/users/camlow325/events{/privacy}","received_events_url":"https://api.github.com/users/camlow325/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/camlow325/puppet-server","description":"Server automation framework and application","fork":true,"url":"https://api.github.com/repos/camlow325/puppet-server","forks_url":"https://api.github.com/repos/camlow325/puppet-server/forks","keys_url":"https://api.github.com/repos/camlow325/puppet-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/camlow325/puppet-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/camlow325/puppet-server/teams","hooks_url":"https://api.github.com/repos/camlow325/puppet-server/hooks","issue_events_url":"https://api.github.com/repos/camlow325/puppet-server/issues/events{/number}","events_url":"https://api.github.com/repos/camlow325/puppet-server/events","assignees_url":"https://api.github.com/repos/camlow325/puppet-server/assignees{/user}","branches_url":"https://api.github.com/repos/camlow325/puppet-server/branches{/branch}","tags_url":"https://api.github.com/repos/camlow325/puppet-server/tags","blobs_url":"https://api.github.com/repos/camlow325/puppet-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/camlow325/puppet-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/camlow325/puppet-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/camlow325/puppet-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/camlow325/puppet-server/statuses/{sha}","languages_url":"https://api.github.com/repos/camlow325/puppet-server/languages","stargazers_url":"https://api.github.com/repos/camlow325/puppet-server/stargazers","contributors_url":"https://api.github.com/repos/camlow325/puppet-server/contributors","subscribers_url":"https://api.github.com/repos/camlow325/puppet-server/subscribers","subscription_url":"https://api.github.com/repos/camlow325/puppet-server/subscription","commits_url":"https://api.github.com/repos/camlow325/puppet-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/camlow325/puppet-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/camlow325/puppet-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/camlow325/puppet-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/camlow325/puppet-server/contents/{+path}","compare_url":"https://api.github.com/repos/camlow325/puppet-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/camlow325/puppet-server/merges","archive_url":"https://api.github.com/repos/camlow325/puppet-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/camlow325/puppet-server/downloads","issues_url":"https://api.github.com/repos/camlow325/puppet-server/issues{/number}","pulls_url":"https://api.github.com/repos/camlow325/puppet-server/pulls{/number}","milestones_url":"https://api.github.com/repos/camlow325/puppet-server/milestones{/number}","notifications_url":"https://api.github.com/repos/camlow325/puppet-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/camlow325/puppet-server/labels{/name}","releases_url":"https://api.github.com/repos/camlow325/puppet-server/releases{/id}","deployments_url":"https://api.github.com/repos/camlow325/puppet-server/deployments","created_at":"2014-10-01T21:59:27Z","updated_at":"2016-01-14T21:34:15Z","pushed_at":"2016-03-07T21:21:59Z","git_url":"git://github.com/camlow325/puppet-server.git","ssh_url":"git@github.com:camlow325/puppet-server.git","clone_url":"https://github.com/camlow325/puppet-server.git","svn_url":"https://github.com/camlow325/puppet-server","homepage":"https://tickets.puppetlabs.com/browse/SERVER","size":3460,"stargazers_count":0,"watchers_count":0,"language":"Clojure","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"puppetlabs:stable","ref":"stable","sha":"e902288a45286ec8c3a8a15e185050351864d62c","user":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":19546488,"name":"puppet-server","full_name":"puppetlabs/puppet-server","owner":{"login":"puppetlabs","id":234268,"avatar_url":"https://avatars.githubusercontent.com/u/234268?v=3","gravatar_id":"","url":"https://api.github.com/users/puppetlabs","html_url":"https://github.com/puppetlabs","followers_url":"https://api.github.com/users/puppetlabs/followers","following_url":"https://api.github.com/users/puppetlabs/following{/other_user}","gists_url":"https://api.github.com/users/puppetlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/puppetlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/puppetlabs/subscriptions","organizations_url":"https://api.github.com/users/puppetlabs/orgs","repos_url":"https://api.github.com/users/puppetlabs/repos","events_url":"https://api.github.com/users/puppetlabs/events{/privacy}","received_events_url":"https://api.github.com/users/puppetlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/puppetlabs/puppet-server","description":"Server automation framework and application","fork":false,"url":"https://api.github.com/repos/puppetlabs/puppet-server","forks_url":"https://api.github.com/repos/puppetlabs/puppet-server/forks","keys_url":"https://api.github.com/repos/puppetlabs/puppet-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/puppetlabs/puppet-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/puppetlabs/puppet-server/teams","hooks_url":"https://api.github.com/repos/puppetlabs/puppet-server/hooks","issue_events_url":"https://api.github.com/repos/puppetlabs/puppet-server/issues/events{/number}","events_url":"https://api.github.com/repos/puppetlabs/puppet-server/events","assignees_url":"https://api.github.com/repos/puppetlabs/puppet-server/assignees{/user}","branches_url":"https://api.github.com/repos/puppetlabs/puppet-server/branches{/branch}","tags_url":"https://api.github.com/repos/puppetlabs/puppet-server/tags","blobs_url":"https://api.github.com/repos/puppetlabs/puppet-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/puppetlabs/puppet-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/puppetlabs/puppet-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/puppetlabs/puppet-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/puppetlabs/puppet-server/statuses/{sha}","languages_url":"https://api.github.com/repos/puppetlabs/puppet-server/languages","stargazers_url":"https://api.github.com/repos/puppetlabs/puppet-server/stargazers","contributors_url":"https://api.github.com/repos/puppetlabs/puppet-server/contributors","subscribers_url":"https://api.github.com/repos/puppetlabs/puppet-server/subscribers","subscription_url":"https://api.github.com/repos/puppetlabs/puppet-server/subscription","commits_url":"https://api.github.com/repos/puppetlabs/puppet-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/puppetlabs/puppet-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/puppetlabs/puppet-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/puppetlabs/puppet-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/puppetlabs/puppet-server/contents/{+path}","compare_url":"https://api.github.com/repos/puppetlabs/puppet-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/puppetlabs/puppet-server/merges","archive_url":"https://api.github.com/repos/puppetlabs/puppet-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/puppetlabs/puppet-server/downloads","issues_url":"https://api.github.com/repos/puppetlabs/puppet-server/issues{/number}","pulls_url":"https://api.github.com/repos/puppetlabs/puppet-server/pulls{/number}","milestones_url":"https://api.github.com/repos/puppetlabs/puppet-server/milestones{/number}","notifications_url":"https://api.github.com/repos/puppetlabs/puppet-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/puppetlabs/puppet-server/labels{/name}","releases_url":"https://api.github.com/repos/puppetlabs/puppet-server/releases{/id}","deployments_url":"https://api.github.com/repos/puppetlabs/puppet-server/deployments","created_at":"2014-05-07T19:00:24Z","updated_at":"2016-03-02T23:33:55Z","pushed_at":"2016-03-07T21:21:59Z","git_url":"git://github.com/puppetlabs/puppet-server.git","ssh_url":"git@github.com:puppetlabs/puppet-server.git","clone_url":"https://github.com/puppetlabs/puppet-server.git","svn_url":"https://github.com/puppetlabs/puppet-server","homepage":"https://tickets.puppetlabs.com/browse/SERVER","size":5821,"stargazers_count":132,"watchers_count":132,"language":"Clojure","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":84,"mirror_url":null,"open_issues_count":8,"forks":84,"open_issues":8,"watchers":132,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/944"},"html":{"href":"https://github.com/puppetlabs/puppet-server/pull/944"},"issue":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/issues/944"},"comments":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/issues/944/comments"},"review_comments":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/944/comments"},"review_comment":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/pulls/944/commits"},"statuses":{"href":"https://api.github.com/repos/puppetlabs/puppet-server/statuses/66022c15a98b1f58636e7fefdb735c6f34d9d413"}}}}