{"action":"created","comment":{"url":"https://api.github.com/repos/buchgr/bazel-remote/pulls/comments/179755271","pull_request_review_id":110060483,"id":179755271,"diff_hunk":"@@ -20,27 +34,27 @@ type SizedLRU struct {\n \t// SizedLRU will evict items as needed to maintain the total size of the cache\n \t// below maxSize.\n \tmaxSize int64\n+\tonEvict EvictCallback","path":"cache/lru.go","position":30,"original_position":30,"commit_id":"4d93001178c79fed65cb6774817c32373b340b27","original_commit_id":"4d93001178c79fed65cb6774817c32373b340b27","user":{"login":"Yannic","id":7313747,"avatar_url":"https://avatars3.githubusercontent.com/u/7313747?v=4","gravatar_id":"","url":"https://api.github.com/users/Yannic","html_url":"https://github.com/Yannic","followers_url":"https://api.github.com/users/Yannic/followers","following_url":"https://api.github.com/users/Yannic/following{/other_user}","gists_url":"https://api.github.com/users/Yannic/gists{/gist_id}","starred_url":"https://api.github.com/users/Yannic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yannic/subscriptions","organizations_url":"https://api.github.com/users/Yannic/orgs","repos_url":"https://api.github.com/users/Yannic/repos","events_url":"https://api.github.com/users/Yannic/events{/privacy}","received_events_url":"https://api.github.com/users/Yannic/received_events","type":"User","site_admin":false},"body":"Just one quick note here:\r\nmaps in go aren't safe to use from multiple goroutines https://golang.org/doc/faq#atomic_maps\r\nCould we add a mutex (RW?) here and make sure we access the map only after acquiring a lock.","created_at":"2018-04-06T13:23:04Z","updated_at":"2018-04-06T13:42:33Z","html_url":"https://github.com/buchgr/bazel-remote/pull/36#discussion_r179755271","pull_request_url":"https://api.github.com/repos/buchgr/bazel-remote/pulls/36","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/buchgr/bazel-remote/pulls/comments/179755271"},"html":{"href":"https://github.com/buchgr/bazel-remote/pull/36#discussion_r179755271"},"pull_request":{"href":"https://api.github.com/repos/buchgr/bazel-remote/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/buchgr/bazel-remote/pulls/36","id":179707952,"html_url":"https://github.com/buchgr/bazel-remote/pull/36","diff_url":"https://github.com/buchgr/bazel-remote/pull/36.diff","patch_url":"https://github.com/buchgr/bazel-remote/pull/36.patch","issue_url":"https://api.github.com/repos/buchgr/bazel-remote/issues/36","number":36,"state":"open","locked":false,"title":"Use LRU to evict individual items","user":{"login":"nicolov","id":10729479,"avatar_url":"https://avatars1.githubusercontent.com/u/10729479?v=4","gravatar_id":"","url":"https://api.github.com/users/nicolov","html_url":"https://github.com/nicolov","followers_url":"https://api.github.com/users/nicolov/followers","following_url":"https://api.github.com/users/nicolov/following{/other_user}","gists_url":"https://api.github.com/users/nicolov/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolov/subscriptions","organizations_url":"https://api.github.com/users/nicolov/orgs","repos_url":"https://api.github.com/users/nicolov/repos","events_url":"https://api.github.com/users/nicolov/events{/privacy}","received_events_url":"https://api.github.com/users/nicolov/received_events","type":"User","site_admin":false},"body":"Previously, files were deleted in bulk once the total cache size grew over the high water mark set in EnsureSpacer. This PR changes this behavior, and instead checks for the cache size limit before each requests. Just enough files are deleted to make space for the incoming items, thus improving the average disk utilization.\r\n\r\nI moved the actual cache implementation away from the HTTP handler and into a separate `Cache` interface, with an eye towards making alternate backends (such as HTTP/multilevel/etc..).","created_at":"2018-04-05T15:11:54Z","updated_at":"2018-04-06T13:42:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d31be6aaf52ddb50567f8c47c0b9eb8ad0f7d4f0","assignee":null,"assignees":[],"requested_reviewers":[{"login":"buchgr","id":1388179,"avatar_url":"https://avatars0.githubusercontent.com/u/1388179?v=4","gravatar_id":"","url":"https://api.github.com/users/buchgr","html_url":"https://github.com/buchgr","followers_url":"https://api.github.com/users/buchgr/followers","following_url":"https://api.github.com/users/buchgr/following{/other_user}","gists_url":"https://api.github.com/users/buchgr/gists{/gist_id}","starred_url":"https://api.github.com/users/buchgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buchgr/subscriptions","organizations_url":"https://api.github.com/users/buchgr/orgs","repos_url":"https://api.github.com/users/buchgr/repos","events_url":"https://api.github.com/users/buchgr/events{/privacy}","received_events_url":"https://api.github.com/users/buchgr/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/buchgr/bazel-remote/pulls/36/commits","review_comments_url":"https://api.github.com/repos/buchgr/bazel-remote/pulls/36/comments","review_comment_url":"https://api.github.com/repos/buchgr/bazel-remote/pulls/comments{/number}","comments_url":"https://api.github.com/repos/buchgr/bazel-remote/issues/36/comments","statuses_url":"https://api.github.com/repos/buchgr/bazel-remote/statuses/4d93001178c79fed65cb6774817c32373b340b27","head":{"label":"nicolov:nicolov-do-lru","ref":"nicolov-do-lru","sha":"4d93001178c79fed65cb6774817c32373b340b27","user":{"login":"nicolov","id":10729479,"avatar_url":"https://avatars1.githubusercontent.com/u/10729479?v=4","gravatar_id":"","url":"https://api.github.com/users/nicolov","html_url":"https://github.com/nicolov","followers_url":"https://api.github.com/users/nicolov/followers","following_url":"https://api.github.com/users/nicolov/following{/other_user}","gists_url":"https://api.github.com/users/nicolov/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolov/subscriptions","organizations_url":"https://api.github.com/users/nicolov/orgs","repos_url":"https://api.github.com/users/nicolov/repos","events_url":"https://api.github.com/users/nicolov/events{/privacy}","received_events_url":"https://api.github.com/users/nicolov/received_events","type":"User","site_admin":false},"repo":{"id":119906375,"name":"bazel-remote","full_name":"nicolov/bazel-remote","owner":{"login":"nicolov","id":10729479,"avatar_url":"https://avatars1.githubusercontent.com/u/10729479?v=4","gravatar_id":"","url":"https://api.github.com/users/nicolov","html_url":"https://github.com/nicolov","followers_url":"https://api.github.com/users/nicolov/followers","following_url":"https://api.github.com/users/nicolov/following{/other_user}","gists_url":"https://api.github.com/users/nicolov/gists{/gist_id}","starred_url":"https://api.github.com/users/nicolov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicolov/subscriptions","organizations_url":"https://api.github.com/users/nicolov/orgs","repos_url":"https://api.github.com/users/nicolov/repos","events_url":"https://api.github.com/users/nicolov/events{/privacy}","received_events_url":"https://api.github.com/users/nicolov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/nicolov/bazel-remote","description":"A remote cache for Bazel","fork":true,"url":"https://api.github.com/repos/nicolov/bazel-remote","forks_url":"https://api.github.com/repos/nicolov/bazel-remote/forks","keys_url":"https://api.github.com/repos/nicolov/bazel-remote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nicolov/bazel-remote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nicolov/bazel-remote/teams","hooks_url":"https://api.github.com/repos/nicolov/bazel-remote/hooks","issue_events_url":"https://api.github.com/repos/nicolov/bazel-remote/issues/events{/number}","events_url":"https://api.github.com/repos/nicolov/bazel-remote/events","assignees_url":"https://api.github.com/repos/nicolov/bazel-remote/assignees{/user}","branches_url":"https://api.github.com/repos/nicolov/bazel-remote/branches{/branch}","tags_url":"https://api.github.com/repos/nicolov/bazel-remote/tags","blobs_url":"https://api.github.com/repos/nicolov/bazel-remote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nicolov/bazel-remote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nicolov/bazel-remote/git/refs{/sha}","trees_url":"https://api.github.com/repos/nicolov/bazel-remote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nicolov/bazel-remote/statuses/{sha}","languages_url":"https://api.github.com/repos/nicolov/bazel-remote/languages","stargazers_url":"https://api.github.com/repos/nicolov/bazel-remote/stargazers","contributors_url":"https://api.github.com/repos/nicolov/bazel-remote/contributors","subscribers_url":"https://api.github.com/repos/nicolov/bazel-remote/subscribers","subscription_url":"https://api.github.com/repos/nicolov/bazel-remote/subscription","commits_url":"https://api.github.com/repos/nicolov/bazel-remote/commits{/sha}","git_commits_url":"https://api.github.com/repos/nicolov/bazel-remote/git/commits{/sha}","comments_url":"https://api.github.com/repos/nicolov/bazel-remote/comments{/number}","issue_comment_url":"https://api.github.com/repos/nicolov/bazel-remote/issues/comments{/number}","contents_url":"https://api.github.com/repos/nicolov/bazel-remote/contents/{+path}","compare_url":"https://api.github.com/repos/nicolov/bazel-remote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nicolov/bazel-remote/merges","archive_url":"https://api.github.com/repos/nicolov/bazel-remote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nicolov/bazel-remote/downloads","issues_url":"https://api.github.com/repos/nicolov/bazel-remote/issues{/number}","pulls_url":"https://api.github.com/repos/nicolov/bazel-remote/pulls{/number}","milestones_url":"https://api.github.com/repos/nicolov/bazel-remote/milestones{/number}","notifications_url":"https://api.github.com/repos/nicolov/bazel-remote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nicolov/bazel-remote/labels{/name}","releases_url":"https://api.github.com/repos/nicolov/bazel-remote/releases{/id}","deployments_url":"https://api.github.com/repos/nicolov/bazel-remote/deployments","created_at":"2018-02-01T23:30:13Z","updated_at":"2018-03-28T10:22:04Z","pushed_at":"2018-04-05T19:48:05Z","git_url":"git://github.com/nicolov/bazel-remote.git","ssh_url":"git@github.com:nicolov/bazel-remote.git","clone_url":"https://github.com/nicolov/bazel-remote.git","svn_url":"https://github.com/nicolov/bazel-remote","homepage":null,"size":2445,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"buchgr:master","ref":"master","sha":"d9df18e564eb95c37ba84a256f7f5d834233c231","user":{"login":"buchgr","id":1388179,"avatar_url":"https://avatars0.githubusercontent.com/u/1388179?v=4","gravatar_id":"","url":"https://api.github.com/users/buchgr","html_url":"https://github.com/buchgr","followers_url":"https://api.github.com/users/buchgr/followers","following_url":"https://api.github.com/users/buchgr/following{/other_user}","gists_url":"https://api.github.com/users/buchgr/gists{/gist_id}","starred_url":"https://api.github.com/users/buchgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buchgr/subscriptions","organizations_url":"https://api.github.com/users/buchgr/orgs","repos_url":"https://api.github.com/users/buchgr/repos","events_url":"https://api.github.com/users/buchgr/events{/privacy}","received_events_url":"https://api.github.com/users/buchgr/received_events","type":"User","site_admin":false},"repo":{"id":101615462,"name":"bazel-remote","full_name":"buchgr/bazel-remote","owner":{"login":"buchgr","id":1388179,"avatar_url":"https://avatars0.githubusercontent.com/u/1388179?v=4","gravatar_id":"","url":"https://api.github.com/users/buchgr","html_url":"https://github.com/buchgr","followers_url":"https://api.github.com/users/buchgr/followers","following_url":"https://api.github.com/users/buchgr/following{/other_user}","gists_url":"https://api.github.com/users/buchgr/gists{/gist_id}","starred_url":"https://api.github.com/users/buchgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/buchgr/subscriptions","organizations_url":"https://api.github.com/users/buchgr/orgs","repos_url":"https://api.github.com/users/buchgr/repos","events_url":"https://api.github.com/users/buchgr/events{/privacy}","received_events_url":"https://api.github.com/users/buchgr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/buchgr/bazel-remote","description":"A remote HTTP/1.1 cache for Bazel","fork":false,"url":"https://api.github.com/repos/buchgr/bazel-remote","forks_url":"https://api.github.com/repos/buchgr/bazel-remote/forks","keys_url":"https://api.github.com/repos/buchgr/bazel-remote/keys{/key_id}","collaborators_url":"https://api.github.com/repos/buchgr/bazel-remote/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/buchgr/bazel-remote/teams","hooks_url":"https://api.github.com/repos/buchgr/bazel-remote/hooks","issue_events_url":"https://api.github.com/repos/buchgr/bazel-remote/issues/events{/number}","events_url":"https://api.github.com/repos/buchgr/bazel-remote/events","assignees_url":"https://api.github.com/repos/buchgr/bazel-remote/assignees{/user}","branches_url":"https://api.github.com/repos/buchgr/bazel-remote/branches{/branch}","tags_url":"https://api.github.com/repos/buchgr/bazel-remote/tags","blobs_url":"https://api.github.com/repos/buchgr/bazel-remote/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/buchgr/bazel-remote/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/buchgr/bazel-remote/git/refs{/sha}","trees_url":"https://api.github.com/repos/buchgr/bazel-remote/git/trees{/sha}","statuses_url":"https://api.github.com/repos/buchgr/bazel-remote/statuses/{sha}","languages_url":"https://api.github.com/repos/buchgr/bazel-remote/languages","stargazers_url":"https://api.github.com/repos/buchgr/bazel-remote/stargazers","contributors_url":"https://api.github.com/repos/buchgr/bazel-remote/contributors","subscribers_url":"https://api.github.com/repos/buchgr/bazel-remote/subscribers","subscription_url":"https://api.github.com/repos/buchgr/bazel-remote/subscription","commits_url":"https://api.github.com/repos/buchgr/bazel-remote/commits{/sha}","git_commits_url":"https://api.github.com/repos/buchgr/bazel-remote/git/commits{/sha}","comments_url":"https://api.github.com/repos/buchgr/bazel-remote/comments{/number}","issue_comment_url":"https://api.github.com/repos/buchgr/bazel-remote/issues/comments{/number}","contents_url":"https://api.github.com/repos/buchgr/bazel-remote/contents/{+path}","compare_url":"https://api.github.com/repos/buchgr/bazel-remote/compare/{base}...{head}","merges_url":"https://api.github.com/repos/buchgr/bazel-remote/merges","archive_url":"https://api.github.com/repos/buchgr/bazel-remote/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/buchgr/bazel-remote/downloads","issues_url":"https://api.github.com/repos/buchgr/bazel-remote/issues{/number}","pulls_url":"https://api.github.com/repos/buchgr/bazel-remote/pulls{/number}","milestones_url":"https://api.github.com/repos/buchgr/bazel-remote/milestones{/number}","notifications_url":"https://api.github.com/repos/buchgr/bazel-remote/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/buchgr/bazel-remote/labels{/name}","releases_url":"https://api.github.com/repos/buchgr/bazel-remote/releases{/id}","deployments_url":"https://api.github.com/repos/buchgr/bazel-remote/deployments","created_at":"2017-08-28T07:20:47Z","updated_at":"2018-04-05T14:58:26Z","pushed_at":"2018-04-05T19:48:06Z","git_url":"git://github.com/buchgr/bazel-remote.git","ssh_url":"git@github.com:buchgr/bazel-remote.git","clone_url":"https://github.com/buchgr/bazel-remote.git","svn_url":"https://github.com/buchgr/bazel-remote","homepage":"https://bazel.build","size":2403,"stargazers_count":20,"watchers_count":20,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":7,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":7,"open_issues":9,"watchers":20,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/buchgr/bazel-remote/pulls/36"},"html":{"href":"https://github.com/buchgr/bazel-remote/pull/36"},"issue":{"href":"https://api.github.com/repos/buchgr/bazel-remote/issues/36"},"comments":{"href":"https://api.github.com/repos/buchgr/bazel-remote/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/buchgr/bazel-remote/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/buchgr/bazel-remote/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/buchgr/bazel-remote/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/buchgr/bazel-remote/statuses/4d93001178c79fed65cb6774817c32373b340b27"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"Yannic"}}