{"action":"created","comment":{"url":"https://api.github.com/repos/fnproject/fn/pulls/comments/215440344","pull_request_review_id":152707187,"id":215440344,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTQ0MDM0NA==","diff_hunk":"@@ -102,6 +130,22 @@ func NewDocker(conf drivers.Config) *DockerDriver {\n \t\t}\n \t}\n \n+\timageEvictChan := make(chan docker.APIImages, 10)\n+\tonEvictor := OnImageEvict(imageEvictChan)\n+\tgo NewImageCleaner(driver, imageEvictChan)\n+\n+\tlogrus.Infof(\"Max cache size: %v\\n\", conf.MaxImageCacheSize)\n+\tdriver.imageLRU = NewLRU(int64(conf.MaxImageCacheSize), onEvictor)\n+\n+\tgo func() {","path":"api/agent/drivers/docker/docker.go","position":51,"original_position":51,"commit_id":"e6b5def266e5779f10ffefcaad832cc261df5b8f","original_commit_id":"e6b5def266e5779f10ffefcaad832cc261df5b8f","user":{"login":"skinowski","id":6537562,"node_id":"MDQ6VXNlcjY1Mzc1NjI=","avatar_url":"https://avatars2.githubusercontent.com/u/6537562?v=4","gravatar_id":"","url":"https://api.github.com/users/skinowski","html_url":"https://github.com/skinowski","followers_url":"https://api.github.com/users/skinowski/followers","following_url":"https://api.github.com/users/skinowski/following{/other_user}","gists_url":"https://api.github.com/users/skinowski/gists{/gist_id}","starred_url":"https://api.github.com/users/skinowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/skinowski/subscriptions","organizations_url":"https://api.github.com/users/skinowski/orgs","repos_url":"https://api.github.com/users/skinowski/repos","events_url":"https://api.github.com/users/skinowski/events{/privacy}","received_events_url":"https://api.github.com/users/skinowski/received_events","type":"User","site_admin":false},"body":"so, if the go-routine completes after loadDockerImages() below, we might accidentally clear on-disk requested images.","created_at":"2018-09-05T22:04:58Z","updated_at":"2018-09-05T22:04:58Z","html_url":"https://github.com/fnproject/fn/pull/1175#discussion_r215440344","pull_request_url":"https://api.github.com/repos/fnproject/fn/pulls/1175","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/fnproject/fn/pulls/comments/215440344"},"html":{"href":"https://github.com/fnproject/fn/pull/1175#discussion_r215440344"},"pull_request":{"href":"https://api.github.com/repos/fnproject/fn/pulls/1175"}}},"pull_request":{"url":"https://api.github.com/repos/fnproject/fn/pulls/1175","id":209230068,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA5MjMwMDY4","html_url":"https://github.com/fnproject/fn/pull/1175","diff_url":"https://github.com/fnproject/fn/pull/1175.diff","patch_url":"https://github.com/fnproject/fn/pull/1175.patch","issue_url":"https://api.github.com/repos/fnproject/fn/issues/1175","number":1175,"state":"open","locked":false,"title":"WIP initial cut at cleaning old docker images","user":{"login":"ericfode","id":50846,"node_id":"MDQ6VXNlcjUwODQ2","avatar_url":"https://avatars0.githubusercontent.com/u/50846?v=4","gravatar_id":"","url":"https://api.github.com/users/ericfode","html_url":"https://github.com/ericfode","followers_url":"https://api.github.com/users/ericfode/followers","following_url":"https://api.github.com/users/ericfode/following{/other_user}","gists_url":"https://api.github.com/users/ericfode/gists{/gist_id}","starred_url":"https://api.github.com/users/ericfode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ericfode/subscriptions","organizations_url":"https://api.github.com/users/ericfode/orgs","repos_url":"https://api.github.com/users/ericfode/repos","events_url":"https://api.github.com/users/ericfode/events{/privacy}","received_events_url":"https://api.github.com/users/ericfode/received_events","type":"User","site_admin":false},"body":"- Link to issue this resolves\r\n\r\n- What I did\r\nAdded a control loop to clean up images, as well as an LRU to keep track of them.\r\n\r\n- How I did it\r\nAdded an LRU, on eviction from the lru a message is passed on a channel to a goroutine that takes care of cleaning up the image.\r\n\r\n- How to verify it\r\nRun 100 functions with different 1GB images, if they all worked the evictor did it's job.\r\n\r\n- One line description for the changelog\r\nClean up after old functions when there is no more space.\r\n\r\n- One moving picture involving robots (not mandatory but encouraged)\r\n![robot](https://media.giphy.com/media/FHEjBpiqMwSuA/giphy.gif)\r\n","created_at":"2018-08-17T18:53:46Z","updated_at":"2018-09-05T22:04:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a836da771884419da2a5886073401f6eeacc1773","assignee":null,"assignees":[],"requested_reviewers":[{"login":"rdallman","id":2935111,"node_id":"MDQ6VXNlcjI5MzUxMTE=","avatar_url":"https://avatars0.githubusercontent.com/u/2935111?v=4","gravatar_id":"","url":"https://api.github.com/users/rdallman","html_url":"https://github.com/rdallman","followers_url":"https://api.github.com/users/rdallman/followers","following_url":"https://api.github.com/users/rdallman/following{/other_user}","gists_url":"https://api.github.com/users/rdallman/gists{/gist_id}","starred_url":"https://api.github.com/users/rdallman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rdallman/subscriptions","organizations_url":"https://api.github.com/users/rdallman/orgs","repos_url":"https://api.github.com/users/rdallman/repos","events_url":"https://api.github.com/users/rdallman/events{/privacy}","received_events_url":"https://api.github.com/users/rdallman/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/fnproject/fn/pulls/1175/commits","review_comments_url":"https://api.github.com/repos/fnproject/fn/pulls/1175/comments","review_comment_url":"https://api.github.com/repos/fnproject/fn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fnproject/fn/issues/1175/comments","statuses_url":"https://api.github.com/repos/fnproject/fn/statuses/e6b5def266e5779f10ffefcaad832cc261df5b8f","head":{"label":"fnproject:add-cleaner","ref":"add-cleaner","sha":"e6b5def266e5779f10ffefcaad832cc261df5b8f","user":{"login":"fnproject","id":30273834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjczODM0","avatar_url":"https://avatars2.githubusercontent.com/u/30273834?v=4","gravatar_id":"","url":"https://api.github.com/users/fnproject","html_url":"https://github.com/fnproject","followers_url":"https://api.github.com/users/fnproject/followers","following_url":"https://api.github.com/users/fnproject/following{/other_user}","gists_url":"https://api.github.com/users/fnproject/gists{/gist_id}","starred_url":"https://api.github.com/users/fnproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnproject/subscriptions","organizations_url":"https://api.github.com/users/fnproject/orgs","repos_url":"https://api.github.com/users/fnproject/repos","events_url":"https://api.github.com/users/fnproject/events{/privacy}","received_events_url":"https://api.github.com/users/fnproject/received_events","type":"Organization","site_admin":false},"repo":{"id":97652025,"node_id":"MDEwOlJlcG9zaXRvcnk5NzY1MjAyNQ==","name":"fn","full_name":"fnproject/fn","owner":{"login":"fnproject","id":30273834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjczODM0","avatar_url":"https://avatars2.githubusercontent.com/u/30273834?v=4","gravatar_id":"","url":"https://api.github.com/users/fnproject","html_url":"https://github.com/fnproject","followers_url":"https://api.github.com/users/fnproject/followers","following_url":"https://api.github.com/users/fnproject/following{/other_user}","gists_url":"https://api.github.com/users/fnproject/gists{/gist_id}","starred_url":"https://api.github.com/users/fnproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnproject/subscriptions","organizations_url":"https://api.github.com/users/fnproject/orgs","repos_url":"https://api.github.com/users/fnproject/repos","events_url":"https://api.github.com/users/fnproject/events{/privacy}","received_events_url":"https://api.github.com/users/fnproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fnproject/fn","description":"The container native, cloud agnostic serverless platform.","fork":false,"url":"https://api.github.com/repos/fnproject/fn","forks_url":"https://api.github.com/repos/fnproject/fn/forks","keys_url":"https://api.github.com/repos/fnproject/fn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fnproject/fn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fnproject/fn/teams","hooks_url":"https://api.github.com/repos/fnproject/fn/hooks","issue_events_url":"https://api.github.com/repos/fnproject/fn/issues/events{/number}","events_url":"https://api.github.com/repos/fnproject/fn/events","assignees_url":"https://api.github.com/repos/fnproject/fn/assignees{/user}","branches_url":"https://api.github.com/repos/fnproject/fn/branches{/branch}","tags_url":"https://api.github.com/repos/fnproject/fn/tags","blobs_url":"https://api.github.com/repos/fnproject/fn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fnproject/fn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fnproject/fn/git/refs{/sha}","trees_url":"https://api.github.com/repos/fnproject/fn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fnproject/fn/statuses/{sha}","languages_url":"https://api.github.com/repos/fnproject/fn/languages","stargazers_url":"https://api.github.com/repos/fnproject/fn/stargazers","contributors_url":"https://api.github.com/repos/fnproject/fn/contributors","subscribers_url":"https://api.github.com/repos/fnproject/fn/subscribers","subscription_url":"https://api.github.com/repos/fnproject/fn/subscription","commits_url":"https://api.github.com/repos/fnproject/fn/commits{/sha}","git_commits_url":"https://api.github.com/repos/fnproject/fn/git/commits{/sha}","comments_url":"https://api.github.com/repos/fnproject/fn/comments{/number}","issue_comment_url":"https://api.github.com/repos/fnproject/fn/issues/comments{/number}","contents_url":"https://api.github.com/repos/fnproject/fn/contents/{+path}","compare_url":"https://api.github.com/repos/fnproject/fn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fnproject/fn/merges","archive_url":"https://api.github.com/repos/fnproject/fn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fnproject/fn/downloads","issues_url":"https://api.github.com/repos/fnproject/fn/issues{/number}","pulls_url":"https://api.github.com/repos/fnproject/fn/pulls{/number}","milestones_url":"https://api.github.com/repos/fnproject/fn/milestones{/number}","notifications_url":"https://api.github.com/repos/fnproject/fn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fnproject/fn/labels{/name}","releases_url":"https://api.github.com/repos/fnproject/fn/releases{/id}","deployments_url":"https://api.github.com/repos/fnproject/fn/deployments","created_at":"2017-07-18T23:22:46Z","updated_at":"2018-09-05T20:50:06Z","pushed_at":"2018-09-05T20:33:37Z","git_url":"git://github.com/fnproject/fn.git","ssh_url":"git@github.com:fnproject/fn.git","clone_url":"https://github.com/fnproject/fn.git","svn_url":"https://github.com/fnproject/fn","homepage":"http://fnproject.io","size":164840,"stargazers_count":3284,"watchers_count":3284,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":232,"mirror_url":null,"archived":false,"open_issues_count":114,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":232,"open_issues":114,"watchers":3284,"default_branch":"master"}},"base":{"label":"fnproject:master","ref":"master","sha":"24f41c29b21619c0ba1ce66e61714b24a7c92a31","user":{"login":"fnproject","id":30273834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjczODM0","avatar_url":"https://avatars2.githubusercontent.com/u/30273834?v=4","gravatar_id":"","url":"https://api.github.com/users/fnproject","html_url":"https://github.com/fnproject","followers_url":"https://api.github.com/users/fnproject/followers","following_url":"https://api.github.com/users/fnproject/following{/other_user}","gists_url":"https://api.github.com/users/fnproject/gists{/gist_id}","starred_url":"https://api.github.com/users/fnproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnproject/subscriptions","organizations_url":"https://api.github.com/users/fnproject/orgs","repos_url":"https://api.github.com/users/fnproject/repos","events_url":"https://api.github.com/users/fnproject/events{/privacy}","received_events_url":"https://api.github.com/users/fnproject/received_events","type":"Organization","site_admin":false},"repo":{"id":97652025,"node_id":"MDEwOlJlcG9zaXRvcnk5NzY1MjAyNQ==","name":"fn","full_name":"fnproject/fn","owner":{"login":"fnproject","id":30273834,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMwMjczODM0","avatar_url":"https://avatars2.githubusercontent.com/u/30273834?v=4","gravatar_id":"","url":"https://api.github.com/users/fnproject","html_url":"https://github.com/fnproject","followers_url":"https://api.github.com/users/fnproject/followers","following_url":"https://api.github.com/users/fnproject/following{/other_user}","gists_url":"https://api.github.com/users/fnproject/gists{/gist_id}","starred_url":"https://api.github.com/users/fnproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fnproject/subscriptions","organizations_url":"https://api.github.com/users/fnproject/orgs","repos_url":"https://api.github.com/users/fnproject/repos","events_url":"https://api.github.com/users/fnproject/events{/privacy}","received_events_url":"https://api.github.com/users/fnproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fnproject/fn","description":"The container native, cloud agnostic serverless platform.","fork":false,"url":"https://api.github.com/repos/fnproject/fn","forks_url":"https://api.github.com/repos/fnproject/fn/forks","keys_url":"https://api.github.com/repos/fnproject/fn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fnproject/fn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fnproject/fn/teams","hooks_url":"https://api.github.com/repos/fnproject/fn/hooks","issue_events_url":"https://api.github.com/repos/fnproject/fn/issues/events{/number}","events_url":"https://api.github.com/repos/fnproject/fn/events","assignees_url":"https://api.github.com/repos/fnproject/fn/assignees{/user}","branches_url":"https://api.github.com/repos/fnproject/fn/branches{/branch}","tags_url":"https://api.github.com/repos/fnproject/fn/tags","blobs_url":"https://api.github.com/repos/fnproject/fn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fnproject/fn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fnproject/fn/git/refs{/sha}","trees_url":"https://api.github.com/repos/fnproject/fn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fnproject/fn/statuses/{sha}","languages_url":"https://api.github.com/repos/fnproject/fn/languages","stargazers_url":"https://api.github.com/repos/fnproject/fn/stargazers","contributors_url":"https://api.github.com/repos/fnproject/fn/contributors","subscribers_url":"https://api.github.com/repos/fnproject/fn/subscribers","subscription_url":"https://api.github.com/repos/fnproject/fn/subscription","commits_url":"https://api.github.com/repos/fnproject/fn/commits{/sha}","git_commits_url":"https://api.github.com/repos/fnproject/fn/git/commits{/sha}","comments_url":"https://api.github.com/repos/fnproject/fn/comments{/number}","issue_comment_url":"https://api.github.com/repos/fnproject/fn/issues/comments{/number}","contents_url":"https://api.github.com/repos/fnproject/fn/contents/{+path}","compare_url":"https://api.github.com/repos/fnproject/fn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fnproject/fn/merges","archive_url":"https://api.github.com/repos/fnproject/fn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fnproject/fn/downloads","issues_url":"https://api.github.com/repos/fnproject/fn/issues{/number}","pulls_url":"https://api.github.com/repos/fnproject/fn/pulls{/number}","milestones_url":"https://api.github.com/repos/fnproject/fn/milestones{/number}","notifications_url":"https://api.github.com/repos/fnproject/fn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fnproject/fn/labels{/name}","releases_url":"https://api.github.com/repos/fnproject/fn/releases{/id}","deployments_url":"https://api.github.com/repos/fnproject/fn/deployments","created_at":"2017-07-18T23:22:46Z","updated_at":"2018-09-05T20:50:06Z","pushed_at":"2018-09-05T20:33:37Z","git_url":"git://github.com/fnproject/fn.git","ssh_url":"git@github.com:fnproject/fn.git","clone_url":"https://github.com/fnproject/fn.git","svn_url":"https://github.com/fnproject/fn","homepage":"http://fnproject.io","size":164840,"stargazers_count":3284,"watchers_count":3284,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":232,"mirror_url":null,"archived":false,"open_issues_count":114,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":232,"open_issues":114,"watchers":3284,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fnproject/fn/pulls/1175"},"html":{"href":"https://github.com/fnproject/fn/pull/1175"},"issue":{"href":"https://api.github.com/repos/fnproject/fn/issues/1175"},"comments":{"href":"https://api.github.com/repos/fnproject/fn/issues/1175/comments"},"review_comments":{"href":"https://api.github.com/repos/fnproject/fn/pulls/1175/comments"},"review_comment":{"href":"https://api.github.com/repos/fnproject/fn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fnproject/fn/pulls/1175/commits"},"statuses":{"href":"https://api.github.com/repos/fnproject/fn/statuses/e6b5def266e5779f10ffefcaad832cc261df5b8f"}},"author_association":"NONE"}}
{"actor":{"display_login":"skinowski"}}